mysql add foreign key 外键

{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}

 

Last modified onSunday, 14 October 2012 04:07

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169
  • Published in MYSQL
  • Read 3429 times

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