Lecture 3B: Relational Model Flashcards
What is another name for relational Model?
Conceptual model of data.
describe facts for the relational model.
- all data is structured within relations (tables).
2. dominant database solution
Quickly list the DB design from top to bottom
- conceptual db design
- logical db design
- physical db design
define relation
table with columns and rows.
it is a set, thus no duplicate tuples in a relationship
define attributes
a column of a relation
define tuples
a row in a relation
define domain
a set of allowable values for one or more attributes
define degree (of a relation)
number of attributes it contains
define cardinality (of a relation)
number of tuples it contains
Maths behind Relational Model contains Cartesian products of two sets (D1, D2),
what other names are used to describe these sets?
- a set of ordered pairs
- sets D1 and D2 are called domains.
can contain n domains. therefore the relation represented with that product has degree n
and elements are n-tuples
in a relational model we have constraints that impose restrictions on values in a column or a combination of columns within a table.
define constraint.
a column or group of columns must be unique across all rows in the table
e.g. student_no must be unique in student table.
define superkey
attribute or set of attributes that uniquely identify a tuple in a relation
define candidate key
a superkey such that none of its subset is a superkey for that relation.
e.g. its unique and irreducible
what is a primary key
the candidate key, that is used to uniquely identify tuples in a relation.
thus, there may be many candidate keys, but only one is chosen as PK
What is a foreign key
an attribute or set of attributes within one relation (home relation) that matches the candidate key in another relation.
Describe “NULL’
- represents a value that is unknown or the absence of a value
- null is different from zero.
- null can be used when we don’t know the value for an attribute to prevent inserting a false value
list two integrity constraints
- entity integrity
2. referential integrity
define entity integrity
no attribute of a primary key can be null
define referential integrity
if a FK exists, either:
1.the value of the FK matches the value of the Candidate key in the home relation
- value of the FK is null
List three perspectives
- user
- conceptual
- storage
describe how users view the data.
table, row, column
describe the conceptual perspective
relation, tuple, attribute
describe and explain the storage perspective
file, record, field
describe the details of how the data is stored in the computer.
list the two constraints
- domain
2. primary key
explain domain constraint
the value of each attribute in each row must be from the domain assigned to this attribute
explain primary key constraint
two distinct tuples in any state of the relation, cannot have identical values for all attributes in the key.