Lecture14Slides501.ppt

# Lecture14Slides501.ppt - CSC 355 Database Systems

• Notes
• 26

This preview shows pages 1–8. Sign up to view the full content.

CSC 355 Database Systems Lecture 14 Eric J. Schwabe School of Computing, DePaul University Winter 2018

This preview has intentionally blurred sections. Sign up to view the full version.

Today: Relational Database Design Review minimal basis and 3NF decomposition Last decomposition examples Constraints Triggers? 2
Minimal Basis A minimal basis of F is a set G that is equivalent to F and is “as small as possible”: 1. The right side of every dependency is a single attribute 2. No X A can be replaced with Y A, where Y is a proper subset of X, and still be equivalent to F 3. No X A can be removed and still be equivalent to F 3

This preview has intentionally blurred sections. Sign up to view the full version.

Constructing a Minimal Basis Start with a set of functional dependencies… 1. Split each X Z into an equivalent set with only one attribute on the right side of each f.d. 2. For each X {a}, replace it with Y {a} (where Y is a proper subset of X) as long as the resulting set is equivalent 3. Remove every X {a} that can be removed as long as the resulting set is equivalent 4
3NF Decomposition Algorithm 1. Find a minimal basis G of F 2. For each set X that appears as the determinant of some functional dependency in G: Find all k dependencies of the form X A i in G, and create a relation in D with the attributes in X and A 1 ,…,A k . 3. If none of the relations in D contains a candidate key of R, find a candidate key K of R and create a relation in D whose attributes are the attributes of K. 4. Remove any redundant relations. (A relation Q 1 in D is redundant if all of its attributes are included in another relation Q 2 in D.) 5

This preview has intentionally blurred sections. Sign up to view the full version.

Comparison of Algorithms BCNF decomposition algorithm: No redundancy in relations Dependency preservation not guaranteed Lossless join guaranteed 3NF decomposition algorithm: Some redundancy may remain in relations that have multiple candidate keys Dependency preservation guaranteed Lossless join guaranteed 6
Final Decomposition Example INVOICE ( OrderID, OrderDate, CustomerID,

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.
• Spring '16

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern