140 Part I EXAM PREPARATION Step by Step
140 Part I EXAM PREPARATION Step by Step 3.6 shows you how to define a relationship from the Table Design Properties box: STEP BY STEP 3.6 Using the Table Designer to Create a Relationship 1. From the Enterprise Manager, select the table that contains the Foreign Key element of the relationship. 2. Right-click on the table name that will represent the subsidiary table to be referenced, and select Design Table from the pop-up menu. 3. Select Table and Index Properties. 4. Click on the Relationships tab and click New. 5. Select the desired options from the dialog, and click Close to establish the relationship (see Figure 3.6). 6. Exit and save changes to the table. You can define a relationship when creating or altering a table definition. The following example defines a relationship using T-SQL: CREATE TABLE OrderDetails ( DetailsID smallint, OrderID smallint FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), QtyOrdered bigint, WarehouseLocation smallint ) The most common relationships are one-to-many, in which the unique value in one table has many subsidiary records in the second table. Another form of relationship, which is usually used to split a table with an extraordinary number of columns, is a one-to-one relationship. The use of one-to-one splits a table and associates a single unique value in one table with the same unique value in a second table. A many-to-many relationship can also be defined, but this form of referencing requires three tables and is really two separate one-to-many relationships.
For reliable and cheap web hosting services please check javaweb hosting website.