Mysql setting constraints

From MyWiki
Revision as of 12:33, 22 January 2019 by George2 (Talk | contribs)

Jump to: navigation, search

https://www.percona.com/blog/2017/04/06/dealing-mysql-error-code-1215-cannot-add-foreign-key-constraint

  CONSTRAINT education_ibfk_1
    FOREIGN KEY (profile_id)
    REFERENCES Profile (profile_id)
    ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT education_ibfk_2
    FOREIGN KEY (institution_id)
    REFERENCES Institution (institution_id)
    ON DELETE CASCADE ON UPDATE CASCADE,
 
 
CREATE TABLE notes
(
hostname VARCHAR(30),
notes VARCHAR(100),
CONSTRAINT myconst_1
FOREIGN KEY (hostname)
REFERENCES sslhosts (hostname)
);

http://www.mysqltutorial.org/mysql-primary-key/