How does SQLserver set primary key and foreign key?

Reprinted: (389 messages) How to set primary key and foreign key in SQL server? _How to set foreign keys in sqlserver_Memory blog written for you-CSDN blog

For example: There are two tables DLB (login table) and XSB (student table)

 

 Requirement: Set the XH column of XSB as the primary key, and the XH column of DLB ​​as the foreign key.
Operation: interface type: select one of the tables, right-click to design, select XH, right-click → relationship

→ Add at the bottom left

 

On the right, the table and column specification can set the primary key and foreign key!

 

 

 

Guess you like

Origin blog.csdn.net/chentiebo/article/details/131070614