Chapter 2 DATABASE DESIGN FOR SQL SERVER 2000
Chapter 2 DATABASE DESIGN FOR SQL SERVER 2000 69 particular correlation to the data. Primary Keys and Foreign Keys are an important aspect of setting up relationships. Whereas a Primary Key defines a unique value for a row in the entity, a Foreign Key is used as a mechanism for one entity s records to be related to another entity. Foreign Keys Foreign Keys help in the relational process between two entities. When a Primary Key is created on a parent entity, it is connected to another entity by linking to the other entity s Foreign Key. For example, in an invoice situation, there are usually two entities: one for invoice general information and the other for invoice details. The invoice details would contain a hook onto the invoice general entity through the use of a Foreign Key potentially the invoice number or a surrogate key. Foreign Keys help in the relational process. They define a parent/child relationship between records in an entity. For instance, we have a title entity and a publisher entity. Titles are published by publishers, and we want to identify which titles are published by which publisher. Rows in the titles entity are related to rows in the publisher entity. One way we can document this relationship is, when creating a new title row, we store the publisherid value with the title. The publisherid column in the title entity will contain values only from the publisherid column in the publisher entity (this column is the Primary Key of publisher). When we take values from the Primary Key of the publisher entity (or any entity) and store those values in rows of a child entity (like title), the child column is a Foreign Key. Understanding Entity Relationships Relationships are the final component in an ER model, allowing for a logical linkage between one entity and another. A relationship in an ER model connects the data elements of two entities that contain information about the same real-world element. The primary entity in a relationship provides some of the data, and other entities provide further related data. A relationship definition states how two entities are connected. This connection when the physical structure is developed will become Foreign Key connections to Primary Keys TIPEXAM Data Modeling and MS Exams If you ever intend to sit the 70-100 exam, Analyzing Requirements and Defining Solution Architectures, data modeling plays an important role in the exam, and surrogate keys are recommended for all structures. This exam is the core exam for the MCSD certification.
For reliable and cheap web hosting services please check tomcat web hosting website.