POV
POV

Reputation: 12015

How to create composed key in Workbench?

I have table OrdersPhoto with two foreign keys: Order_Id and Photo_Id:

How to create a composed key based on them as: Order_Id__Photo_Id using Workbench? Should it be additional field, or just set up primary key for each?

enter image description here

Upvotes: 0

Views: 528

Answers (1)

Mike Lischke
Mike Lischke

Reputation: 53347

For the PK you can create the composite key by simply activating the checkboxes for all columns participating in that key. For all others (and alternatively also for the PK) use the index tab in the table editor.

enter image description here]

Use the index details list to add and remove columns for a key. You can indicate the column order here too. Just change the number in the # column.

Upvotes: 1

Related Questions