Datasheet

15
Chapter 1: Introducing T-SQL and Data Management Systems
As a practical example, you can revisit the employee example. When your employee sells a product, his or
her identifying information is added to the Sale table to record who the responsible employee was, as
illustrated in Figure 1 - 7 . In this case, the Employee table is the parent table and the Sale table is the child table.
Figure 1-7
Because the same employee could sell products to many customers, the relationship between the
Employee table and the Sale table is called a one - to - many relationship . The fact that the employee is the
unique participant in the relationship makes it the parent table . Relationships are very often parent - child
relationships , which means that the record in the parent table must exist before the child record can be
added. In the example, because every employee is not required to make a sale, the relationship is more
accurately described as a one - to - zero - or - more relationship . In Figure 1 - 7 this relationship is represented
by a key and infinity symbol, which doesn t adequately model the true relationship because you don ’ t
know if the EmployeeKey field is nullable. In Figure 1 - 8 , the more traditional and informative “ crows
feet symbol is used. The relationship symbol in this figure represents an exactly one (the double vertical
lines) to zero (the ring) or more (the crows feet) relationship. Figure 1 - 9 shows the two tables with an
exactly one to one or more relationship symbol. The PK abbreviation stands for primary key, while the
FK stands for foreign key. Because a table can have multiple foreign keys, they are numbered
sequentially starting at 1.
Figure 1-8
Figure 1-9
CH001.indd 15CH001.indd 15 3/26/10 11:35:39 AM3/26/10 11:35:39 AM