MySQL Forums
Forum List  »  MySQL Workbench

Re: Problems with foreign keys in MySQL
Posted by: Ahmet SABAN
Date: July 07, 2017 07:52AM

Last two corrections are:
ALTER TABLE `test_apptest`.`Rights` ADD CONSTRAINT PRIMARY KEY (ID);

ALTER TABLE `test_apptest`.`Roles_have_Rights`
ADD CONSTRAINT `fk_Roles_have_Rights_Rights1`
FOREIGN KEY (`Rights_ID`)
REFERENCES `test_apptest`.`Rights` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ENGINE = InnoDB;

ALTER TABLE `test_apptest`.`Countries` ADD CONSTRAINT PRIMARY KEY (ID);

ALTER TABLE `test_apptest`.`States`
ADD CONSTRAINT `fk_States_Countries1`
FOREIGN KEY (`Countries_ID`)
REFERENCES `test_apptest`.`Countries` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ENGINE = InnoDB;

With this modification to my SQL script, THE PROBLEM IS SOLVED.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Problems with foreign keys in MySQL
87
July 07, 2017 07:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.