Database Reference
In-Depth Information
EMPLOYEE Relation
Columns
SocSecNumber
EmployeeName
Phone
Position
DeptCode
214-56-7835
Robert Moses
516-777-9584
Programmer
501
123-44-5546
Kassia Raj
718-312-4488
Analyst
101-54-3838
Andrew Rogers
212-313-1267
Manager
408
213-36-7854
Samuel Prabhu
212-126-3428
Controller
201
311-33-4520
Kaitlin Jones
718-567-4321
Assistant
512-22-8542
Carey Smith
732-346-5533
Senior VP
301
111-22-3344
Amanda Lupo
908-212-5629
Executive VP
101
122-65-5378
215-576-4598
DBA
501
Tabitha Williams
Figure 8-3
Employee relation: tuples.
Figure 8-3 shows the rows or tuples for the EMPLOYEE relation.
If there are 5000 employees in the organization, the relation will contain 5000
rows. The number of tuples in a relation is known as the cardinality of the relation.
For an EMPLOYEE relation with 5000 rows, the cardinality is 5000.
Now, because a relation is considered as a mathematical set, this EMPLOYEE
relation is a set of 5000 data elements. Manipulation of data in the EMPLOYEE
relation, therefore, becomes a set operation. Later on, you will study set operations
and learn how to apply these in working with data in a relational model.
Each row represents a particular employee. Look at the row for the employee
Carey Smith. Note the value shown under each column in this row. Each of the
values in the columns describes the employee Carey Smith. Each value represents
one piece of data about the employee. All data for the employee are contained in
the specific row.
Primary Key
As mentioned above, in a relation, each tuple represents one instance of the rela-
tion. In an EMPLOYEE relation with 5000 rows, each row represents a particular
employee. But, how can we know which row represents an employee we are looking
for? To identify a row uniquely, we can use the attribute values. We may say that if
the value of the attribute EmployeeName is “Carey Smith” that row represents this
particular employee. What if there is another Carey Smith in the organization? You
need some attribute whose values will uniquely identify individual tuples. Note that
the attribute SocSecNumber can be used to identify a tuple uniquely.
Given below are definitions of identifiers in a relation:
Superkey. A set of attributes that uniquely identifies each tuple in a relation.
Key. A minimal set of attributes that uniquely identifies each tuple in a relation.
Composite key. A key consisting of more than one attribute.
Candidate key. A set of attributes that can be chosen to serve the key.
Search WWH ::




Custom Search