
Here is a screenshot of Flamerobin showing constraints for table CUSTOMER.
First of all I'll add the foreign key constraints, here is MySQL's syntax:
ALTER TABLE `employee`.`customer` ADD CONSTRAINT `INTEG_127` FOREIGN KEY `INTEG_127` (`country`)
REFERENCES `country` (`country`) ON DELETE RESTRICT ON UPDATE RESTRICT;

Another nice thing, foreign keys referencing the same table are supported in both databases, see this example:
ADD CONSTRAINT `INTEG_35` FOREIGN KEY `INTEG_35` (`head_dept`)
REFERENCES `department` (`dept_no`)
ON DELETE CASCADE
ON UPDATE RESTRICT;
Note that those constraints imply an index with the same name on the referencing field.
Of course unique constraints are supported, like:
ALTER TABLE `employee`.`department` ADD UNIQUE `INTEG_30`(`department`);
Multi-column constraints also work fine in both databases:
ALTER TABLE `employee`.`employee` ADD CONSTRAINT `INTEG_54` FOREIGN KEY `INTEG_54` (`job_code`, `job_grade`, `job_country`)
REFERENCES `job` (`job_code`, `job_grade`, `job_country`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
No comments:
Post a Comment