Module 2: Relational Data Model Flashcards
What are relations?
The main construct for representing data in a relational model. It is an unordered set of unique, non-duplicated tuples.
Relations are composed of the following:
– a relation name
– tuples
– attribute names
– attribute values (of a particular domain)
What is a domain?
A domain is a set of ATOMIC values; they can’t be broken down any further.
Each domain has a particular data type.
What are attributes?
The “columns” of the relation are named attributes, each with the own domain.
The number of attributes in a relation is the DEGREE of the relation.
What are tuples?
An ordered list of n values that represent all the data for a particular row in a relation.
What is relation schema?
Includes the relation name and, in square brackets, the list of attributes.
R [A1, A2, A3…]
What is a relation instance?
An instance of a relation schema shows the data in a relation at a particular moment in time. Includes the relation name and, in curly brackets, all the tuples of the relation.
r = {T1, T2, T3…}
What is the proper ordering of tuples?
Syntactically, the tuples can be in any order.
Semantically, each tuple must be in the same order as the attributes (and their domains).
What are the five main integrity constraints?
1) Domain constraints
2) Key constraints
3) Entity integrity constraints
4) Referential integrity constraints
5) Semantic integrity constraints
What is a domain constraint?
Each attribute belongs to a domain, i.e., it must include only a specified data type.
What is a key?
A key is the attribute within a relation that uniquely identifies a tuple.
What is a superkey?
Any combination of a relation’s attributes that also includes the primary key.
What is the key constraint?
The primary key in a relation (a set) must be unique at all times.
What is the entity integrity constraint?
Primary keys can NEVER be null; if they consist of multiple attributes, none of those attributes can be NULL at any time.
What is a foreign key?
When one relation has, as one of its attributes, the primary keys of another relation; these foreign keys allow us to reference that other relation.
What is the referential integrity constraint?
A relation cannot have a foreign key that does not yet exist as a primary key in another relation.