Hi Victoria,

yes... we come closer now. I can already spot my 2nd mistake which I made. ;-)

I was believing that the index setup in table child for the foreign key must 
setup as primary key (talking about id1 and id2). That would explain the 
error messages to me.

That leaves only a few questions now.

I will try it now and feedback shortly.

Best regards

Nils Valentin
Tokyo/Japan



2003年 6月 11日 水曜日 22:41、Victoria Reznichenko さんは書きました:
> "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

-- 
---
Valentin Nils
Internet Technology

 E-Mail: [EMAIL PROTECTED]
 URL: http://www.knowd.co.jp
 Personal URL: http://www.knowd.co.jp/staff/nils


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

Reply via email to