relational database Flashcards
what are relations made up of
an instance and a relation schema
instance
a table with rows and columns
relation schema
specifies the relations name and type of each column
cardinality
number of rows
degree/arity
number of fields/attributes
contraints
logical rules that establish the integrity of data
integrity constraints
a condition that must be true for any database instance
legal instance
satisfies all specified integrity constraints
what are the 3 types of integrity contstriants
domain constraints
entity integrity constraints
referential integrity
domain constraints
the value of the attribute must be an element of the attributes domain
entity integrity constraint
a key value cannot be duplicated or left empty
referential integrity
connects tables together through a foreign key
foreign key
a peripheral attribute that creates referential integrity between entity sets
in which two ways can foreign keys be made
importing the primary key from one table to another
creating a new table that holds the primary key of both tables
what are some constraints for foreign keys
they must have the same name and domain type as the referencing relation and related entities must have the same value