Review Questions 6, 8, and 9
6. How is a primary key specified?
A primary key is specified by the selecting the column, right-clicking, then selecting Set Primary Key.
8. How is a relationship created in SQL server?
In the table design view, right click the column name of the entity you want to create a relationship with and then select "Relationships" which opens the Properties window with the Relationships tab selected. Click on "New" and then verify the "Primary key table" and "Foreign key table". Select the primary key from the grid below the "Primary key table" name (left side of grid) and then select the column name you right-clicked on earlier from the grid below the " Foreign key table" name (right side of grid). Selecting each one in turn sets the two into the desired relationship.
9. How is a concatenated primary key created?
In the table design view of SQL Server, select all the columns that make up the primary key and then select Set as Primary Key.
Discussion Questions 4 and 5
4. Explain how referential integrity is set up in SQL Server. When you have your Foreign Keys set up correctly, and have Cascade Update & Cascade Deletes set as needed, that's just about all you really need to do. It is used to make sure that data doesn't get orphaned.
5. What restrictions does referential integrity place on the way data is entered into tables? Once the tables are created and the relationship is established, the data can be entered. In general, data can be placed in tables containing foreign keys only after the data is entered into the tables that they reference. This restriction means that data must be inserted first into the MEMBER table. If not, the data for the VISIT table will be rejected for the referential integrity violations.