Exam 4 Flashcards
Mapping of EER diagrams to relations will in ________ cases, result in a database that is normalized?
a) All
b) Some
c) No
All
The 4 elements of normalising a database
1) No redundancy of facts
2) No clutterig of facts
3) Must preserve information
4) Must preserve functional dependencies (e.g. if I know email, I know name and birthdate)
How might you end up with a table that is not a relation (or not F2… non-first normal form function)
Example: if you have tags against a record… it is multivalued so you’d technically have many tags against one row. So instead you replicate the rest of the info for each tag
What’s the problem with redundancy in a relation?
Requires multiple places to do the update which can mean inconsistency.
Insertions, based on functional requirements, cause what problems?
Can lead to NULL values.
For example, if you say anyone born in 1970 has 40k salary… and there is no person born in 1970, then you have to put null values after this statement.
What is the problem with deletion anomalies?
If we delete a user who is the only example of our functional reequirement (e.g. the only user born in 1970) then you lose that requirement (i.e. you don’t have an example of someone with 1970 birth earning 40k)
What’s the problem with update anomalies?
If you have multi-value and do an update in one row, you have to do work to do it everywhere
One answer to anomalies is to decompose tables into multiple tables. What is the problem with this?
This can result in “information loss” where when you recombine the tables, they match too many places and you can no longer rely on any one tuple being correct (i.e. you’ve lost the real connection to the entity and thus, lost the info)
What is another problem with decomposing tables?
Dependency loss. Where we can enforce functional dependencies (e.g. this birthdate requires this salaray) on two sub-tables that don’t share those columns.
How do you fix all the potential anomalies with a relation?
You decompose them into the right combo of columns to align with the functional dependencies.
But how do we get to a place with no functional dependencies?
Functional Dependencies?
What is a functional dependency in discrete math terms?
Let X and Y be sets in R. Y is functionally dependent on X in R IFF for each x is an element of RX, there is a recisely one y taht is element of RY
How do you ensure FULL functional dependency?
You basically make them “functions” in the true math sense. Each unique key or value of x only has one value y
The 3 normal form types
All attributes must depend on the key (1NF), the whole key (2NF), and nothing but the key (3NF), so help me Codd
Does something ever land at 3rd NF and not BCNF?
No. They do in theory but prof never saw in practice