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.
very informative. Thanks!
ReplyDeletethanks a lot.very helpfull for me
ReplyDeleteThis is fantastic!
ReplyDeleteawesome
ReplyDeleteThank you so much for this simple picture! This explains a lot more than any other articles on that issue or any MS Help Topic.
ReplyDeleteThank you! So much easier to understand than any of the other articles or videos I've found. Just a couple of clicks and I have my database all set up with relationships.
ReplyDeletethx
ReplyDeleteThank so Much fro this pic
ReplyDeleteVery nice explanation.
ReplyDelete