Last active
September 28, 2016 20:06
-
-
Save YurePereira/492555b37258dd0b9707635a81926629 to your computer and use it in GitHub Desktop.
Using Foreign Key with MySql and Constraint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Using Foreign Key with MySql and Constraint: | |
| alter table <name_table> | |
| add constraint <fk_name_constraint_1> | |
| foreign key (<column_name_this_table>) | |
| references <table_references> (<column_name_table_references>); | |
| -- Not tested: | |
| alter table <name_table> | |
| add constraint <fk_name_constraint> | |
| foreign key (<name_id>, <name_id_2>, <name_id_3>) | |
| references <table_references> (<name_id>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment