I have two tables, registration & schedules, that look like this:
CREATE TABLE registration (
                        id                    SERIAL NOT NULL UNIQUE,
                        firstname        VARCHAR(256) NOT NULL,
                        middlename    TEXT,
                        lastname        VARCHAR(256),
                        suffix              TEXT,
                        schedule_id      INTEGER REFERENCES schedules(id),
);

CREATE TABLE schedules (
id SERIAL NOT NULL UNIQUE,
                       start_date     DATE NOT NULL,
                       end_date       DATE NOT NULL,
);

The registration table above references the the schedules table via the schedule_id. Why does MySQL allow a row created in the schedules table be DELETED if it has a matching schedule_id in the registration table. These two tables share a relationship based on registration.schedule_id & schedules.id. I've tried this same syntax in PostgreSQL and it doesn't allow the schedules.id record to be deleted without first removing any records in the registration table which carry a matching schedule_id record. Isn't that the point of a relational database?- TO CHECK RELATIONSHIPS between tables and enforce that those relationships aren't broken? I find it disappointing that MySQL ignores this relationship.

Ferindo

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to