Creating relationship between tables is not a big task, but I have noticed that many of us (especially I) want to create these relation in minimum time. We can create relations between tables through T-Sql (most time consuming method) or we can complete this task through graphical design view of table in Sql Server Management Studio. But I like to create these relations with following method.
1. Create table through design view in SSMS (Quick way to create table). In our example we have created following four tables.
2. Create a database diagram by following method
a. Right click on “Database Diagram” and click “New Database Diagram”
b. Add your desired tables. In our case we will add four tables
3. Click on primary key column and drag it to related table. Verify columns to join in pop-up window and press OK for both pop-up windows. Repeat the process with all table and you are done.
4. Cltr + S or click on save button to save diagram and table relations.