Académique Documents
Professionnel Documents
Culture Documents
Due to Codd.
Everything is represented as a relation in the
mathematical sense. Also called tables.
A database therefore is a collection of tables, each of
which has a unique name, and each of which is described
by a schema.
In addition, Codd defined a data manipulation language.
Relational Databases:
Basic Concepts I
Attribute:
A column in a table
Domain
The set of values from which the values of an attribute
are drawn.
Null value
A special value, meaning not known or not
applicable.
Relation schema
A set of attribute names
7
Tuple
A set of values, one for each attribute in the relation
schema over which the tuple is defined, i.e. a mapping
from attributes to the appropriate domains
Relation instance
A set of tuples over the schema of the relation
Relational Databases:
Basic Concepts III
Relational Database
A set of relations, each with a unique name
Normalized Relation
A relation in which every value is atomic (nondecomposable). Hence, every attribute in every tuple
has a single value.
Keys
Candidate Key
A minimal set of attributes that uniquely identifies a
tuple
Primary Key
The candidate key chosen as the identifying key of the
relation
Alternate Key
Candidate keys which are not primary keys
10
Foreign Key
An attribute (or set of attributes) in table R1 which also
occurs as the primary key of relation R2.
R2 is called the referenced relation.
Foreign keys are also called connection keys or
reference attributes.
11
Entity constraint
All attributes in a primary key must be non-null.
Motivation: If the primary key uniquely identifies an
entity in an entity set, then we must ensure that we
have all the relevant information
12
Integrity Rules:
Referential Integrity
Referential integrity
A database cannot contain a tuple with a value for a
foreign key that does not match a primary key value in
the referenced relation.
Or, a foreign key must refer to a tuple that exists.
Motivation: If referential integrity were violated, we
could have relationships between entities that we do
not have any information about.
13
14
15
16
Total Participation
17
Course(cid,ctitle,lid)
19
Representing Specialization
Method 1:
Student(sid,sname)
Graduate(sid,supervisor)
Undergraduate(sid,credits)
Representing Specialization
Method 2:
Form a relation for each entity set with all local and
inherited attributes.
Example:
Student(sid,sname)
Undergraduate(sid,sname,credits)
Graduate(sid,sname,supervisor)
Representing Aggregation
Loan-Manager (employee_id, customer_id, loan_id)
Borrows
Loan
Loan-Manager
Employee
22