Relational Data Model Flashcards
Week 2.1 (22 cards)
3 components of the relational data model
- a structural part - set of rules
- amanipulative part - operations allowed on data
- a set of integrity constraints
define relation
table with columns and rows
what data type is a row in a relation
tuple
define attribute
named column of a relation
define domain
a set of allowable values for one or more attributes
define degree
number of attributes in a relation
example of 3 types of degrees
- unary - 1
- binary - 2
- ternary - 3
define cardinality
number of tuples in a relation
define relational database
collection of normalised relations with distinct relation names
properties of relations
- name is distinct
- each cell contains exactly one single value
- each attribute has a distinct name
- values of an attribute are from the same domain
- each tuple is distinct
- order of attributes has no significance
- order of tuples has no significance
define candidate key
a super key such that no proper subset is a super key within a relation
what are the 2 properties of a candidate key
- uniqueness
- irreducibility
what does irreducibility mean in candidate keys
no proper subset of K has the uniqueness property
define primary key
the candidate key that is used to uniquely identify a tuple within a relation
define foreign key
an attribute, or set of attributes, within one relation that matched the primary (or candidate) key of some relation
what are integrity constraints
set of rules to ensure the data is accurate by controlling the types of data that can be entered into a table
what are the 2 main integrity constraints
- entity integrity
- referential integrity
describe entity integrity
- every relation must have a primary key and the primary key must not contain null values
- implemented through primary key constraint
describe referential integrity
- if a foreign key exists in a relation:
○ 1 - either the foreign key value must match a candidate key value of some tuple in its home relation or
○ 2 - the foreign key values must wholly be null - implemented through the foreign key restraint
what is null
represents a value of an attribute that is currently unknown or is not applicable for this tuple
why do we use null
way to deal with incomplete or exceptional data
define general constraints
additional rules specified by the users or database administrator