mysql add foreign key 外键
- font size decrease font size increase font size
- Print Email
{codecitation class="brush:sql" width="500px"}
-- -------------------------------------------------------------------------------------------
ALTER TALBE tbl_choix_examen
ADD PRIMARY KEY (choix_examen_id);
-- -------------------------------------------------------------------------------------------
ALTER TABLE `tbl_choix_examen` ADD PRIMARY KEY ( `choix_examen_id` )
-- -------------------------------------------------------------------------------------------
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
-- -------------------------------------------------------------------------------------------
ALTER `ilci`.`tbl_choix_examen`
ADD [CONSTRAINT [symbol]] FOREIGN KEY
[index_name] (index_col_name, ...)
REFERENCES tbl_name (index_col_name,...)
[ON DELETE reference_option]
[ON UPDATE reference_option]
-- -------------------------------------------------------------------------------------------
alter table `ilci`.`tbl_choix_examen` add foreign key(choix_examen_stu_id) references tbl_student(stu_id);
-- -------------------------------------------------------------------------------------------
alter table `ilci`.`tbl_choix_examen` add foreign key(choix_examen_emploi_id) references tbl_emploi_du_temps(empl_id);
-- -------------------------------------------------------------------------------------------
alter table `ilci`.`tbl_choix_examen_temps` add foreign key(emploi_du_temps_id) references tbl_emploi_du_temps(empl_id);
-- -------------------------------------------------------------------------------------------
{/codecitation}
Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
back to top