SLIDE 3 Relational data model - 3
70
%
A key is a minimal set of attributes that determines a unique
tuple in a relation (at every moment)
Key of Student ? Key of Module ? Key of Registration ?
Every relation must have a key that is filled (without an unknown
The Relational Model
71
&'
A relational schema is composed of :
- A name
- A list of attributes and their associated domains
- The list of attributes composing the key (the key is underlined)
- Example
Student (StudentId : integer, name : string, address : string,
age : integer between 18 and 35)
Intension vs. Extension
Relational Schema : the intension of the relation Table : the extension of the relation Relational Database: a set of Relational Schemas
The Relational Model
72
(%
Definition
A Foreign Key is a set of attributes appearing as key in
another relation
R1(A1, A2, .... , Ap, Ap+1, ...., An) R2(B1, B2, ......, Bn)
Role
Foreign Keys define referential integrity constraints
between relations
The Relational Model
73
(% !
Updates and Foreign Keys
Insertion: the value of attributes must exist in the
referenced relation.
Insertion of the tuple (4, ‘DB’, 15) in Registration ?
deletion in the referenced relation is possible iff
there are no referencing tuples.
deletion of Student number 2 of Student ?
Foreign Keys reflect the relationships of the E/R
model
The Relational Model