{"id":154,"date":"2011-12-27T15:13:46","date_gmt":"2011-12-27T15:13:46","guid":{"rendered":"https:\/\/shan.info\/new\/mysql-add-foreign-key-%e5%a4%96%e9%94%ae\/"},"modified":"2011-12-27T15:13:46","modified_gmt":"2011-12-27T15:13:46","slug":"mysql-add-foreign-key-%e5%a4%96%e9%94%ae","status":"publish","type":"post","link":"https:\/\/shan.info\/new\/mysql-add-foreign-key-%e5%a4%96%e9%94%ae\/","title":{"rendered":"mysql add foreign key \u5916\u952e"},"content":{"rendered":"<p>{codecitation class=&#8221;brush:sql&#8221; width=&#8221;500px&#8221;}<br \/> &#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>ALTER TALBE tbl_choix_examen<br \/>ADD PRIMARY KEY (choix_examen_id);<br \/>&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>ALTER TABLE `tbl_choix_examen` ADD PRIMARY KEY ( `choix_examen_id` ) <br \/>&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>ALTER TABLE `ilci`.`tbl_choix_examen` ADD PRIMARY KEY ( `choix_examen_id` ) <br \/>ALTER TABLE `tbl_choix_examen` CHANGE `choix_examen_id` `choix_examen_id` INT( 10 ) NOT NULL AUTO_INCREMENT <br \/>&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>ALTER `ilci`.`tbl_choix_examen`<br \/> ADD [CONSTRAINT [symbol]] FOREIGN KEY<br \/> [index_name] (index_col_name, &#8230;)<br \/> REFERENCES tbl_name (index_col_name,&#8230;)<br \/> [ON DELETE reference_option]<br \/> [ON UPDATE reference_option]<br \/>&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>alter table `ilci`.`tbl_choix_examen` add foreign key(choix_examen_stu_id) references tbl_student(stu_id);<br \/>&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>alter table `ilci`.`tbl_choix_examen` add foreign key(choix_examen_emploi_id) references tbl_emploi_du_temps(empl_id);<br \/>&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>alter table `ilci`.`tbl_choix_examen_temps` add foreign key(emploi_du_temps_id) references tbl_emploi_du_temps(empl_id);<br \/>&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/> {\/codecitation}<\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>{codecitation class=&#8221;brush:sql&#8221; width=&#8221;500px&#8221;} &#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-ALTER TALBE tbl_choix_examenADD PRIMARY KEY (choix_examen_id);&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-ALTER TABLE `tbl_choix_examen` ADD PRIMARY KEY ( `choix_examen_id` ) &#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-ALTER TABLE `ilci`.`tbl_choix_examen` ADD PRIMARY KEY ( `choix_examen_id` ) ALTER TABLE `tbl_choix_examen` CHANGE `choix_examen_id` `choix_examen_id` INT( 10 ) NOT NULL AUTO_INCREMENT &#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-ALTER `ilci`.`tbl_choix_examen` ADD [CONSTRAINT [symbol]] FOREIGN KEY [index_name] (index_col_name, &#8230;) REFERENCES tbl_name (index_col_name,&#8230;) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[],"class_list":["post-154","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/comments?post=154"}],"version-history":[{"count":0,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts\/154\/revisions"}],"wp:attachment":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/media?parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/categories?post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/tags?post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}