Tip #6 – How to Create a Multicolumn Primary Key

Primary keys may contain more than one column. Multicolumn primary keys are frequently used for junction tables, which are used to model many-to-many relationships.

Primary keys may contain more than one column. Multicolumn primary keys are frequently used for junction tables, which are used to model many-to-many relationships.

Select a table:


Select a table, junction table

In the Table properties panel on the right, check all the columns that you want inside the key:


In the ‘Table properties’ panel, check all the columns you want inside the key, Multicolumn primary key

Now, you have a multicolumn primary key created:


Now, you have your multicolumn primary key created

You can check out your SQL code by clicking the SQL preview button in the top right corner:


Your multicolumn primary key as seen in the SQL code preview

 
 

Tools in this post

Redgate Data Modeler

Design, update, and manage database schemas

Find out more