0

How can you make two keys in a junction table as primary keys.

I'm trying to create two primary keys in a junction table.

One will be a primary and the other will be a foreign key but also a primary key as well.

Anubis
  • 1
  • 1
  • 4
  • 1
    Possible duplicate of [Can I have multiple primary keys in a single table?](https://stackoverflow.com/questions/217945/can-i-have-multiple-primary-keys-in-a-single-table) – nacho Jun 04 '17 at 11:56
  • but the primary keys must also act as a foreign key as well – Anubis Jun 04 '17 at 11:59
  • All the things you note are more or less possible (technically you can only have 1 primary key in a table but many unique indices). Sometimes it's just easier to try the thing. – apokryfos Jun 04 '17 at 12:07
  • You can only have one Primary Key, but you can have as many foreign keys as you need. In a Key that it´s not primary, you can also set that it´s unique, not null, so you don´t need two primary keys. – nacho Jun 04 '17 at 12:17
  • Thanks all for the help. – Anubis Jun 05 '17 at 09:41

0 Answers0