mySQL Newbie
Member
- Joined
- Sep 11, 2009
- Messages
- 52
- Reaction score
- 0
- Points
- 6
OK, i'm now at Chapter 8 on some book about database, mySQL .
Now i have this problem, i understand the concept about composite key and foreign key.
The syntax for primary key is like this:
CREATE TABLE [table_name] ([column_name] INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
Could you guys write me the syntax to create a foreign key and a composite key. The composite key is the most important.
Oh, and one last easy question,
What does this text do in mySQL :
CONSTRAINT my_contacts_contact_id_fk.
I know that CONSTRAINT is like a thing that gives an error if you give the foreign key a value that didn't exist on the primary key. Could you guys explain it more thorough. Please help me.
Now i have this problem, i understand the concept about composite key and foreign key.
The syntax for primary key is like this:
CREATE TABLE [table_name] ([column_name] INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
Could you guys write me the syntax to create a foreign key and a composite key. The composite key is the most important.
Oh, and one last easy question,
What does this text do in mySQL :
CONSTRAINT my_contacts_contact_id_fk.
I know that CONSTRAINT is like a thing that gives an error if you give the foreign key a value that didn't exist on the primary key. Could you guys explain it more thorough. Please help me.