Composite primary key in MySQL

2002-03-13 Thread nagendra prasad

Dear all,
Will MySQL supports composite primary key constraint? If so what 
is the actual syntax? How foreign key relationship can be 
established in MySQL? Please help me.
Prasad.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php





Composite primary key in MySQL

2002-03-13 Thread Victoria Reznichenko

nagendra,
Wednesday, March 13, 2002, 1:06:18 PM, you wrote:

np Dear all,
np Will MySQL supports composite primary key constraint? If so what 
np is the actual syntax?

Yes, MySQL supports composite primary key.
CREATE TABLE table1(
id1 int NOT NULL,
id2 int NOT NULL,
PRIMARY KEY(id1, id2));

You can read about creating indexes in Paul DoBois's book MySQL.

np How foreign key relationship can be
np established in MySQL? Please help me.

You can read about foreign keys in MySQL at:
http://www.mysql.com/doc/A/N/ANSI_diff_Foreign_Keys.html

Check this link, there you will find examples of foreign keys usage:
http://www.mysql.com/doc/e/x/example-Foreign_keys.html

np Prasad.




-- 
For technical support contracts, goto https://order.mysql.com/
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php