Chapter 7: Relational Database Design Flashcards
What is the data format of OLTP?
Make sure updates to database are minimal
What is the data format of OLAP?
Make sure to keep joins and combining of data to a minimum
What is ETL and what does it do?
ETL: Extract, Transform, & Load
Format of data is transformed and loaded into another database (OLTP -> OLAP)
What makes a good OLTP table?
- Table is about one thing
- The table has a key column(s) and all other columns depend on/describe the key column
- The table is in BCNF (Boyce-Codd Normal Form) or 3NF (Third Normal Form): table does 1 and 2
When does possible repetition of information occur?
When you combine two tables that do not have the same PK, they describe two different things.
What is a block and how does it affect tables?
A block is a specific data amount that the computer reads off of the disk at a time, computers read in blocks.
You want a row of data within a table to be within the size of a block (as defined by the OS)
How are good tables designed? Describe the diagram from class.
Take in a
-1: table schema R
-2: closure of functional dependencies
and then
-I. check if R is good based on the FDs, if it is then pass it on otherwise
-II. decompose R into R1 and R2 and repeat steps 1 and 2 until entire table is processed
lastly check by
-joining all sub-tables made by decomposition
-if the produced table is identical to R then you have made a good table and achieved Lossless join decomposition
What is a Functional Dependency?
- if one or more attribute is dependent on another
- all intricate relationships between columns
- is a fundamental concept behind the concept of keys
When does lossy decomposition occur and what can it result in?
Lossy decomposition occurs when a table is split into sub-tables on a column that wasn’t a PK
-can result in lost data or duplicated data when tables are joined together again
What are the validation questions for checking if a schema abides by BCNF and 3NF?
BCNF/3NF
1. is the functional dependency trivial
2. is the LHS a SK. purpose: “is table about one thing” or (LHS)+ = R
3NF
3. is each individual attribute in the RHS individually a part of a CK. purpose: since it is identified by a CK, then the element is identified by a key in that table and is recognized as a valid member of that table.
-condition 3 implies that a non-key determines other attributes in the table
What are some uses of a functional dependency?
- test relations to see if they are legal under a given set of functional dependencies
- specify constraints on the set of legal relations
What is a trivial FD?
A functional dependency that is satisfied by all instances of a relation
(AB -> A or A -> A)
Explain the family diagram of how to decompose schema R into R1 and R2?
When a table contains a secondary relationship, where there is a dependency, remove that dependency and make a new sub-table, but keep the PK of the sub-table in the original table, where it is now a FK in the original table.
R ->
R1 = (a, b)
R2 = (R-b+a)
What form allows for dependency preservation?
3NF
What makes 3NF different than BCNF?
3NF adds an extra condition where if non-SK dependent attributes in a schema are individually apart of a CK then because they depend on a key they are valid.