Exam Flashcards
RELATIONSHIP TABLES
in a 1 to many relationship what do we do with the entities and the relationship?
combine the the 1 with the relationship (i.e. the one with the arrow)
RELATIONSHIP TABLES
how are participation constraints manifested as in tables?
by not nulls
RELATIONSHIP TABLES
how are key/cardinality constraints manifested?
by foreign keys
RELATIONSHIP TABLES
how are binary relationships manifested?
their own table with a composite primary key that reflects the two different types of relationships they describe
EX. reports_to has supervisor/subordinate so the primary key is supervisor_ssn,subordinate_ssn which are foreign keys of the parent entity
RELATIONSHIP TABLES
how are weak entities displayed?
a weak entity combines the entity with the relationship it is defined by and then uses a partial key composed of its local key and the primary key of the connected entity(s) (also ON DELETE CASCADE/UPDATE)
RELATIONSHIP TABLES
if an entity has a participation constraint does it always require its own table?
not always
ER DIAGRAMS
“must participate”
this means a participation constraint or a thick line connecting the two elements
ER DIAGRAMS
“X is related to NO MORE than ONE Y”
key constraint - draw an arrow pointing to Y from X
ER DIAGRAMS
what is a cardinality constraint?
look for arrows and their can only be one of those elements in a relationship between them
ER DIAGRAMS
what is a participation constraint?
look for thick lines. entities connected must be paired as tuples at all times
ER DIAGRAMS
thick line
> 1
ER DIAGRAMS
arrow
< 1
FDs/NORMAL FORMS
define 3NF
where all FDs have either the superkey on the LHS OR their RHS is part of the superkey
FDs/NORMAL FORMS
How do we synthesize 3NF?
1) reduce to single attribute RHS
2) check LHS to see if every attribute is actually necessary for the FD
3) remove redundant rules (check closures to see/remove repeats)
4) take completed FDs and write out as R1(xy) R2(yz)…
FDs/NORMAL FORMS
define BCNF
where all FDs are strictly have the superkey on the LHS