Relational Model-2
Relational Model-2
Slide 5- 1
Characteristics Of Relations
• Values in a tuple:
– All values are considered atomic (indivisible).
– Each value in a tuple must be from the domain of
the attribute for that column
• If tuple t = <v1, v2, …, vn> is a tuple (row) in
the relation state r of R(A1, A2, …, An)
• Then each vi must be a value from dom(Ai)
• Notation:
– We refer to component values of a tuple t
by:
• t[Ai] or t.Ai
• This is the value vi of attribute Ai for tuple t
– Similarly, t[Au, Av, ..., Aw] refers to the
subtuple of t containing the values of
attributes Au, Av, ..., Aw, respectively in t
Slide 5- 3
Relational Integrity Constraints
Slide 5- 4
Key Constraints
• Superkey of R:
– Is a set of attributes SK of R with the following condition:
• No two tuples in any valid relation state r(R) will have the
same value for SK
• That is, for any distinct tuples t1 and t2 in r(R), t1[SK]
t2[SK]
• This condition must hold in any valid state r(R)
• Key of R:
– A "minimal" superkey
– That is, a key is a superkey K such that removal of any
attribute from K results in a set of attributes that is not a
superkey (does not possess the superkey uniqueness
property)
Slide 5- 5
Key Constraints (continued)
Slide 5- 6
Key Constraints (continued)
Slide 5- 7
CAR table with two candidate keys –
LicenseNumber chosen as Primary Key
Slide 5- 8
Relational Database Schema
Slide 5- 9
COMPANY Database Schema
Slide 5- 10
Entity Integrity
• Entity Integrity:
– The primary key attributes PK of each relation
schema R in S cannot have null values in any tuple of
r(R).
• This is because primary key values are used to identify the
individual tuples.
• t[PK] null for any tuple t in r(R)
• If PK has several attributes, null is not allowed in any of
these attributes
– Note: Other attributes of R may be constrained to
disallow null values, even though they are not
members of the primary key.
Slide 5- 11
Referential Integrity
Slide 5- 12
Referential Integrity
Slide 5- 13
Referential Integrity (or foreign key)
Constraint
Slide 5- 14
Displaying a relational database schema and
its constraints
Slide 5- 15
Referential Integrity Constraints for COMPANY database
Slide 5- 16
Other Types of Constraints
Slide 5- 17
Populated database state
Slide 5- 19