A primary key of a table is not a single column, but it is a set of columns. Here is a good article about Composite Primary Keys.
How to create a composite primary key with Microsoft SQL GUI:
- Open Microsoft SQL Server Management Studio.
- Right-clickon table and select Design.
- Create the first primary key - right-click on the column and select Set Primary Key item.
- Right-click again and select Indexes/Keys...
- Under (General) section, click on Columns line and click button with three dots ...
- Add new primary key from combobox by clicking on empty line in the Column Name column.
- Select sort order from combobox in the Sort Order column.
- Click OK, Close
- Save changes by selecting File/Save, or pressing Ctrl+S
owo
ReplyDelete