Chapter2-Part 1
Chapter2-Part 1
1
Chapter 2 - Objectives
Terminology of relational model.
How tables are used to represent data.
Properties of database relations.
How to identify PK, AK, and FKs.
Meaning of entity integrity and
referential integrity.
Database Schema
Set of relational schemas
E.g. Product(Name, Price, Category,
Manufacturer),
Company(Name, Address, Phone),
.......
10
Example
Relational schema:Product(Name, Price, Category, Manufacturer)
Instance:
Name Price Category Manufacturer
Primary Key
Candidate key selected to identify row/tuple
uniquely within relation.
Alternate Keys
Candidate keys that are not selected to be primary
key.
Foreign Key
An attribute (or combination of attributes) in one
table whose values must match the primary key in
© Pearson Education Limited 1995, 2005
another table. 14
Choosing A Primary Key
Give preference to numeric column(s)
Give preference to single attribute
Give preference to minimal composite attribute
Referential Integrity
If foreign key exists in a relation, either
foreign key value must match a candidate
key value of some tuple in its home
relation or foreign key value must be
totally null.