Difference between revisions of "Mysql setting constraints"

From MyWiki
Jump to: navigation, search
Line 15: Line 15:
 
notes varchar(100),
 
notes varchar(100),
 
constraint my_1
 
constraint my_1
FOREIGN_KEY hostname
+
FOREIGN KEY hostname
 
REFERENCES sslhosts (hostname)
 
REFERENCES sslhosts (hostname)
 
ON DELETE CASCADE ON UPDATE CASCADE
 
ON DELETE CASCADE ON UPDATE CASCADE

Revision as of 12:12, 22 January 2019

  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 my_1
FOREIGN KEY hostname
REFERENCES sslhosts (hostname)
ON DELETE CASCADE ON UPDATE CASCADE
);

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