Lecture 8 and 9 Relational Model
Lecture 8 and 9 Relational Model
THE RELATIONAL
MODEL
Relational Model
Terminology of relational model.
How tables are used to represent data.
Connection between mathematical relations and relations in the
relational model.
Properties of database relations.
How to identify CK, PK, and FKs.
Meaning of entity integrity and referential integrity.
Purpose and advantages of views.
5
© Pearson Education Limited 1995, 2005
Examples of
Attribute Domains
Candidate Key
◦ Superkey (K) such that no proper subset is a superkey
within the relation.
◦ In each tuple of R, values of K uniquely identify that tuple
(uniqueness).
◦ No proper subset of K has the uniqueness property
(irreducibility).
Alternate Keys
◦ Candidate keys that are not selected to be primary key.
Foreign Key
◦ Attribute, or set of attributes, within one relation that
matches candidate key of some (possibly same)
relation.
© Pearson Education Limited 1995, 2005
12
Integrity Constraints
Null
◦ Represents value for an attribute that is currently
unknown or not applicable for tuple.
◦ Deals with incomplete or exceptional data.
◦ Represents the absence of a value and is not the
same as zero or spaces, which are values.
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 wholly null.
View
◦ Dynamic result of one or more relational operations operating on base
relations to produce another relation.
Views are dynamic, meaning that changes made to base relations that
affect view attributes are immediately reflected in the view.