Jump to content

Does UK also serve as a FK?


SaranacLake

Recommended Posts

I have a junction table (child) linking two parent tables.

In the junction table I have a UK on 4 columns. 

The first column is the FK back to parent table-1.

The second column is the FK back to parent table-2.

In MySQL, can I just have a UK on the first 4 columns and have that satisfy the need for the UK plus the need to have indexes on columns that are FKs?

Or do I need to double up, and add a straight idx on column 1 and then on column 2 along with my 4-column UK - which is an index also.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.