II.6.3. Creating Relationships

In the previous section, we show you all the different relationships that your data can have. In this section, it's time for you to actually create and maintain these important constructs.

You have two main options when it comes to defining and then preserving relationships: the SQL Server Management Studio and direct SQL entry. Because both these techniques are equally valuable, we show you both.

II.6.3.1. The SQL Server Management Studio and relationships

When it comes to quickly and clearly defining new tables and all associated relationships, it's pretty hard to beat the SQL Server Management Studio. In this section, we look at how easy it is to perform these important tasks.

To begin, follow these steps to open the SQL Server Management Studio and its table designer:

  1. Launch the SQL Server Management Studio.

  2. Connect to the appropriate SQL Server instance.

  3. Expand the connection's entry in the Object Explorer view.

  4. Expand the Databases folder.

  5. Expand the folder entry for the database where you want to create the table.

  6. Right-click Tables, and choose New Table.

This opens a dialog box where you can interactively create your new table. We cover this subject in-depth in Chapter 4 of this mini-book. For now, pay special attention to the relationship aspect of creating a new table. By selecting the Table Designer menu option, the SQL Server Management Studio offers you a collection of options for defining important relationship, index, and other key settings. ...

Get Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.