Page 125 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 125
Database Management Systems/Managing Database
Notes Consider the Employees entity set with attributes ssn, name, and lot shown in Figure 7.1.
Figure 7.1: The Employees Entity Set
name
ssn lot
Employees
A possible instance of the Employees entity set, containing three Employees entities, is shown
in Figure 7.2 in tabular format.
Figure 7.2: An Instance of the Employees Entity Set
ssn name lot
1 Raju 10
2 Santosh 20
3 Brahma 30
The following SQL statement captures the preceding information, including the domain
constraints and key information:
CREATE TABLE Employees (ssn CHAR (11),
name CHAR (30),
lot INTEGER,
PRIMARY KEY (ssn) )
Relationship Sets (without Constraints) to Tables: A relationship set, like an entity set, is
mapped to a relation in the relation model. To represent a relationship, we must be able to
identify each participating entity and give values to the descriptive attributes of the relationship.
Thus, the attributes of the relation include:
1. The primary key attributes of each participating entity set, as foreign key fields.
2. The descriptive attributes of the relationship set.
The set of non-descriptive attributes is a superkey for the relation. If there are no key constraints,
this set of attributes is a candidate key.
Consider the Works_In2 relationship set shown in Figure 7.3. Each department has offices in
several locations and we want to record the locations at which each employee works.
118 LOVELY PROFESSIONAL UNIVERSITY