Chapter 7: Relational Database Design Flashcards

1
Q

What is the data format of OLTP?

A

Make sure updates to database are minimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the data format of OLAP?

A

Make sure to keep joins and combining of data to a minimum

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is ETL and what does it do?

A

ETL: Extract, Transform, & Load

Format of data is transformed and loaded into another database (OLTP -> OLAP)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What makes a good OLTP table?

A
  1. Table is about one thing
  2. The table has a key column(s) and all other columns depend on/describe the key column
  3. The table is in BCNF (Boyce-Codd Normal Form) or 3NF (Third Normal Form): table does 1 and 2
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

When does possible repetition of information occur?

A

When you combine two tables that do not have the same PK, they describe two different things.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a block and how does it affect tables?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How are good tables designed? Describe the diagram from class.

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a Functional Dependency?

A
  • if one or more attribute is dependent on another
  • all intricate relationships between columns
  • is a fundamental concept behind the concept of keys
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

When does lossy decomposition occur and what can it result in?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the validation questions for checking if a schema abides by BCNF and 3NF?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are some uses of a functional dependency?

A
  • test relations to see if they are legal under a given set of functional dependencies
  • specify constraints on the set of legal relations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a trivial FD?

A

A functional dependency that is satisfied by all instances of a relation
(AB -> A or A -> A)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Explain the family diagram of how to decompose schema R into R1 and R2?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What form allows for dependency preservation?

A

3NF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What makes 3NF different than BCNF?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the purpose of normalization?

A

To form good tables, different forms have different requirements for how a table is structured. This is why BCNF and 3NF exist.

17
Q

What is dependency preservation?

A

All FDs in the original table can be verified in single schemas after decomposition.

18
Q

What are Armstrong’s Axiom’s?

A

Reflexivity/Reflexive Axiom, Augmentation Axiom, Transitivity Axiom

19
Q

What is the Reflexivity/Reflexive Axiom?

A

If a is a subset of b or vice-versa, a -> b.

this is important because it says a relationship is trivial (AB -> A)

20
Q

What is the Augmentation Axiom?

A

if a -> b then ya -> yb

21
Q

What is the Transitivity Axiom?

A

if a -> b and b -> c => a ->c

22
Q

What are the axioms derived from armstrong’s?

A

Union axiom, decomposition axiom, and pseudotransitivity axiom

23
Q

What is the Union Axiom?

A

If a -> b holds and a -> c holds, then a -> bc holds.

24
Q

What is the Decomposition Axiom?

A

If a -> bc holds, then a -> b holds and a -> c holds.

25
Q

What is the Pseudotransitivity Axiom?

A

If a -> b holds and yb -> g holds, then ay -> g holds.

26
Q

Describe the Closure of Attribute Sets algorithm?

A
  1. set result = a
    - Armstrong’s axiom’s guarantee sound & complete
    - based on reflexivity axiom (minimally determines itself)

Loop

  1. If Ln is in “result” then Rn should be in “result” so put Rn in “result”
    - based on transitivity axiom. a -> ABC, if A is in result then A -> y should also be in result
27
Q

How do you get F+ from F?

A
  1. find all possible combinations for LHS
  2. run CAS on each of 1
  3. for each RHS, find all possible combinations.
28
Q

What is a canonical cover?

A

the “minimal” set of functional dependencies equivalent to F, having no redundant dependencies or redundant parts of dependencies

29
Q

What is the easiest way to justify a key?

A

To run CAS on it, a -> a+

30
Q

Why are candidate keys more important than super keys?

A

CKs are more useful than SKs because CKs are minimal SKs, adding onto CKs makes a SK.

31
Q

How do you determine a SK?

A

Using the given functional dependencies, derive all other functional dependencies, and if one key is able to determine all members of the set then it is a SK.
-derivations are easiest done through axioms

32
Q

How do you identify a CK?

A
  1. Find all given combinations of R to get all LHS
  2. Run CAS on all possible LHS and find if a closure of a key produces R. If the key size > 1 then proceed to step 3
  3. make subsets of non-minimal SKs and run CAS on them & if their subsets’ closure’s do not return R then it is a CK
    * *If a single element is found to be a CK then all other keys that contain that element in addition to other elements cannot be CKs**
33
Q

What conditions at the end of the design process are required and what are preferrable?

A
Required:
1. BCNF
2. LLJD
Preferable:
3. Dependency Preservation