Hi Victoria,

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 ?

Best regards

Nils Valentin
Tokyo/Japan



2003年 6月 11日 水曜日 21:20、Nils Valentin さんは書きました:
> Hi Victoria,
>
> I thought so, but also if I try somthing similar like:
>
> ALTER TABLE db ADD FOREIGN KEY (Host) REFERENCES user (Host);
>
> I get the same error.
>
> BTW: Can I change the order of the keys ?
>
> Best regards
>
> Nils Valentin
>
> 2003綛� 6��� 11��� 羂贋����� 17:17���Victoria 
> Reznichenko ����������吾����障
�����:
> > "Nils Valentin" <[EMAIL PROTECTED]> wrote:
> > > I believe that the User column is indexed (please see below):
> > >
> > > show index from user;
> > > +-------+------------+----------+--------------+-------------+---------
> > >-- +-------------+----------+--------+------+------------+---------+
> > >
> > > | Table | Non_unique | Key_name | Seq_in_index | Column_name |
> > > | Collation
> > >
> > > Cardinality | Sub_part | Packed | Null | Index_type | Comment |
> > > +-------+------------+----------+--------------+-------------+---------
> > >-- +-------------+----------+--------+------+------------+---------+
> > >
> > > | user  |          0 | PRIMARY  |            1 | Host        | A
> > >
> > > 15 |     NULL | NULL   |      | BTREE      |         |
> > >
> > > | user  |          0 | PRIMARY  |            2 | User        | A
> > >
> > > 15 |     NULL | NULL   |      | BTREE      |         |
> > > +-------+------------+----------+--------------+-------------+---------
> > >-- +-------------+----------+--------+------+------------+---------+
> > >
> > >
> > > Any comments appreciated.
> >
> > If you have multi-column index, 'User' must be the first part of the
> > index. In your case User is the second part of index.
> >
> >
> > --
> > 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

-- 
---
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