"Nils Valentin" <[EMAIL PROTECTED]> wrote:
> 
> Thank you for the reply. I understand now that it must be the first part of 
> the primary index in both related tables.
> 
> But what I still dont understand is the following:
> 
> How do I create several foreign keys in a single table (f.e a link table) 
> which relates f.e to 10 other tables ?
> 

For example like that:

mysql> CREATE TABLE p1(id INT PRIMARY KEY)TYPE=INNODB;
Query OK, 0 rows affected (0.03 sec)

mysql> CREATE TABLE p2(id INT PRIMARY KEY)TYPE=INNODB;
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE TABLE child(
    -> id1 INT,
    -> id2 INT,
    -> INDEX(id1),
    -> INDEX(id2),
    -> FOREIGN KEY (id1) REFERENCES p1(id),
    -> FOREIGN KEY (id2) REFERENCES p2(id))TYPE=InnoDB;
Query OK, 0 rows affected (0.01 sec)


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





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to