How to create composed key in Workbench?
up vote
0
down vote
favorite
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?
mysql sql mysql-workbench workbench
add a comment |
up vote
0
down vote
favorite
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?
mysql sql mysql-workbench workbench
So, is it enough to set up two foreign keys as primary keys to make compose key?
– OPV
Nov 18 at 1:28
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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?
mysql sql mysql-workbench 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?
mysql sql mysql-workbench workbench
mysql sql mysql-workbench workbench
edited Nov 18 at 1:28
asked Nov 18 at 1:12
OPV
1,29121228
1,29121228
So, is it enough to set up two foreign keys as primary keys to make compose key?
– OPV
Nov 18 at 1:28
add a comment |
So, is it enough to set up two foreign keys as primary keys to make compose key?
– OPV
Nov 18 at 1:28
So, is it enough to set up two foreign keys as primary keys to make compose key?
– OPV
Nov 18 at 1:28
So, is it enough to set up two foreign keys as primary keys to make compose key?
– OPV
Nov 18 at 1:28
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
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.
]
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.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
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.
]
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.
add a comment |
up vote
0
down vote
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.
]
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.
add a comment |
up vote
0
down vote
up vote
0
down vote
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.
]
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.
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.
]
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.
answered Nov 18 at 10:51
Mike Lischke
20.2k348101
20.2k348101
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357043%2fhow-to-create-composed-key-in-workbench%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
So, is it enough to set up two foreign keys as primary keys to make compose key?
– OPV
Nov 18 at 1:28