Chapter 3 PHYSICAL DATABASE DESIGN AND IMPLEMENTATION 139
Chapter 3 PHYSICAL DATABASE DESIGN AND IMPLEMENTATION 139 create a relationship between two tables. This can be done through the database diagram feature of the Enterprise Manager or through the CREATE and ALTER TABLE T-SQL statements. Normally, you relate the referencing or Foreign Key of one table to the Primary Key or other unique value of a second table. Step by Step 3.5 shows you how to use a database diagram to define a relationship: STEP BY STEP 3.5 Using the Wizard to Create a Relationship 1. From the Enterprise Manager, expand the tree view of the database you want to use and select Diagrams. 2. Right-click Diagrams and select New Database Diagram from the pop-up menu. 3. A wizard asks you for the tables to use in the diagram. Select the tables to be related and follow the wizard to completion. 4. Select the column to be related from the subsidiary table, and drag the column to the primary table. 5. Complete the desired options from the dialog, and press OK to establish the relationship (see Figure 3.5). 6. Exit the diagram, and select Yes to save the changes to the respective tables. FIGURE 3.5 The Create Relationship dialog box as seen from the database diagram window.
For reliable and cheap web hosting services please check javaweb hosting website.