Professional Documents
Culture Documents
Primary Key
Foreign Key
(implements 1:N relationship
between customer and order)
Combined, these are a composite
primary key (uniquely identifies the
order line)…individually they are
foreign keys (implement M:N
relationship between order and
product)
Integrity constraints
Referential
integrity
constraints are
drawn via arrows
from dependent to
parent table
Referential integrity
• Each attribute is defined, taking the data type and length from
the domain definitions
• For example, the attribute Customer_Name can be defined as a
VARCHAR (variable character) type with length 25
• By specifying NOT NULL, each attribute can be constrained
from being assigned a null value
• The primary key for each table is specified using the
PRIMARY KEY clause at the end of each table definition
Creating relational tables
Locker Employee
Location EmpName
Another Representation of a One-
to-One Relationship
Locker Employee
LockerDesc
Location
Mandatory One-to-One
Relationships
Department Employee
Location EmpName
Representing Many-to-Many
Relationships
Skill Employee
SkillID EmpID
SkillDesc EmpName
Emp_Skill
Foreign Key
SkillID
EMPLOYEE 1:N
Manages
Representing a Recursive
Relationship
Employee
EmpID
EmpID (FK)
Foreign Key is
EmpName The EmpID of the
Manager
Well-structured relations
(a) CUSTOMER
entity type with
simple
attributes
(a) CUSTOMER
entity type with
composite
attribute
Foreign key
Foreign key
Map binary many-to-many (M:N)
relationships
New
Foreign key intersection
relation
Foreign key
Map binary one-to-one relationships