Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.

Slides:



Advertisements
Similar presentations
Schema Refinement: Normal Forms
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
Normalization 1 Instructor: Mohamed Eltabakh Part II.
Normalization Decomposition techniques for ensuring: Lossless joins Dependency preservation Redundancy avoidance We will look at some normal forms: Boyce-Codd.
Announcements Read 6.1 – 6.3 for Wednesday Project Step 3, due now Homework 5, due Friday 10/22 Project Step 4, due Monday Research paper –List of sources.
CS 440 Database Management Systems Practice problems for normalization.
Review for Final Exam Lecture Week 14. Problems on Functional Dependencies and Normal Forms.
Normalization theory exercises Dr. Shiyong Lu Department of Computer Science Wayne State University ©copyright 2007, all rights reserved.
Functional Dependencies and Normalization for Relational Databases.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Normalization.
Ms. Hatoon Al-Sagri CCIS – IS Department Normalization.
CS Algorithm : Decomposition into 3NF  Obviously, the algorithm for lossless join decomp into BCNF can be used to obtain a lossless join decomp.
Normalization DB Tuning CS186 Final Review Session.
Normal Form Design addendum by C. Zaniolo. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Normal Form Design Compute the canonical cover.
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Schema Refinement and Normalization Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus.
Normalization II. Boyce–Codd Normal Form (BCNF) Based on functional dependencies that take into account all candidate keys in a relation, however BCNF.
Chapter 14 Advanced Normalization Transparencies © Pearson Education Limited 1995, 2005.
Chapter 8 Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
CS 405G: Introduction to Database Systems 16. Functional Dependency.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 6 NORMALIZATION FOR RELATIONAL DATABASES Instructor Ms. Arwa Binsaleh.
Database Systems Normal Forms. Decomposition Suppose we have a relation R[U] with a schema U={A 1,…,A n } – A decomposition of U is a set of schemas.
Slide 11-1 Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Revised by IB & SAM, Fasilkom UI, 2005 Exercise – T/F The columns of a.
Chapter 8: Relational Database Design First Normal Form First Normal Form Functional Dependencies Functional Dependencies Decomposition Decomposition Boyce-Codd.
Schema Refinement and Normalization. Functional Dependencies (Review) A functional dependency X  Y holds over relation schema R if, for every allowable.
NormalizationNormalization Chapter 4. Purpose of Normalization Normalization  A technique for producing a set of relations with desirable properties,
Logical Database Design (2 of 3) John Ortiz. Lecture 7Logical Database Design (2)2 Finding All Candidate Keys Let F be a set of FDs satisfied by R(A 1,...,
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Normalization for Relational Databases.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Instructor: Churee Techawut Functional Dependencies and Normalization for Relational Databases Chapter 4 CS (204)321 Database System I.
CS143 Review: Normalization Theory Q: Is it a good table design? We can start with an ER diagram or with a large relation that contain a sample of the.
CSCI 4333 Database Design and Implementation – Exercise (3) Xiang Lian The University of Texas – Pan American Edinburg, TX
Normal Forms through BCNF CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
IST 210 Normalization 2 Todd Bacastow IST 210. Normalization Methods Inspection Closure Functional dependencies are key.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Third Normal Form (3NF) Zaki Malik October 23, 2008.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
ANN.1 CSE4701 Problem th ed  Consider the table:  Consider the table: Orders (O#,I#,Odate, Cust#, Total_amount, Qty_ordered, Total_price, Discount%)
Normalization MIS335 Database Systems. Why Normalization? Optimizing database structure Removing duplications Accelerating the instructions Data integrity!
Schema Refinement and Normalization Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus.
Second Normal Form (2NF) A relation R is in 1NF, and every non-primary-key attribute is fully functionally dependent on the primary key Then R is in 2NF.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Chapter 10_part3 Functional Dependencies and Normalization for Relational Databases.
Al-Imam University Girls Education Center Collage of Computer Science 1 st Semester, 1432/1433H Chapter 10_part 1 Functional Dependencies and Normalization.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
11/06/97J-1 Principles of Relational Design Chapter 12.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Al-Imam University Girls Education Center Collage of Computer Science 1 nd Semester, 1432/1433H Chapter 10_part2 Functional Dependencies and Normalization.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
Relational Data Model, Review Relation Tuple Attribute Domains Candidate key, primary key Key attribute, non-key attribute.
Chapter 14 Functional Dependencies and Normalization Informal Design Guidelines for Relational Databases –Semantics of the Relation Attributes –Redundant.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Study group exercises In attendance: 1. Suppose you have a relation P ( A, B, C, D, E, F ), with functional dependencies (FDs) A  B, BCD  E, E  F Suppose.
Functional Dependency and Normalization
Advanced Normalization
Relational Database Design (Discussion Session)
CS411 Database Systems 08: Midterm Review Kazuhiro Minami 1.
Canonical Cover & Normal Forms
Normal Forms.
Advanced Normalization
Normalization Algorithm
Canonical Cover & Normal Forms
CSCI 4333 Database Design and Implementation – Exercise (3)
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
CSCI 6315 Applied Database Systems – Exercise (5)
Presentation transcript:

Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems (Chapter 10 Tutorial)

Chapter 10 Tutorial1 Exercise 1 Consider a relation R(A, B, C, D, E) with the following dependencies: AB CCD EDE B Is AB a candidate key of this relation? No, AB+ = {A, B, C}. If not, is ABD? Yes, ABD+ = {A, B, C, D, E}.

Chapter 10 Tutorial2 Exercise 2 Consider the following relation: CAR_SALE(Car#, DateSold, Salesman#, Commission%, DiscountAmount) Assume that a car may be sold by multiple salesmen, and hence {Car#, Salesman#} is the primary key. Additional dependencies are: Car#  DateSold Car#  DiscountAmount DateSold  DiscountAmount Salesman#  Commission% Based on the given primary key, is the relation in 1NF, 2NF, 3NF? Why or why not? How would you successively normalize it completely?

Chapter 10 Tutorial3 Exercise 2 The relation is in 1NF because all attribute values are single atomic values. The relation is not in 2NF because: Car#  DateSold Car#  DiscountAmount Salesman#  Commission% Thus, these attributes are not fully functionally dependent on the primary key. 2NF decomposition: CAR_SALE1(Car#, DateSold, DiscountAmount) CAR_SALE2(Car#, Salesman#) CAR_SALE3(Salesman#, Commission%)

Chapter 10 Tutorial4 Exercise 2 The relations are not in 3NF because: Car#  DateSold  DiscountAmount Thus, DateSold is neither a key itself nor a subset of a key and DiscountAmount is not a prime attribute. 3NF decomposition: CAR_SALES1A(Car#, DateSold) CAR_SALES1B(DateSold, DiscountAmount) CAR_SALE2(Car#, Salesman#) CAR_SALE3(Salesman#, Commission%)

Chapter 10 Tutorial5 Exercise 3 Consider the following relation for published books: BOOK(BookTitle, AuthorName, BookType, ListPrice, AuthorAffiliation, Publisher) Suppose the following dependencies exist: BookTitle  BookType, Publisher BookType  ListPrice AuthorName  AuthorAffiliation What normal form is the relation in? explain your answer. Apply normalization until you cannot decompose the relations further. State the reasons behind each decomposition.

Chapter 10 Tutorial6 Exercise 3 The relation is in 1NF and not in 2NF as no attributes are fully functionally dependent on the key (BookTitle and AuthorName). It is also not in 3NF. The relation is not in 2NF because: BookTitle  Publisher, BookType BookType  ListPrice AuthorName  AuthorAffiliation Thus, these attributes are not fully functionally dependent on the primary key. The 2NF decomposition will eliminate the partial dependencies. 2NF decomposition: Book1(BookTitle, AuthorName) Book2(BookTitle, BookType, ListPrice, Publisher) Book3(AuthorName, AuthorAffiliation)

Chapter 10 Tutorial7 Exercise 3 The relations are not in 3NF because: BookTitle  BookType  ListPrice Thus, BookType is neither a key itself nor a subset of a key and ListPrice is not a prime attribute. The 3NF decomposition will eliminate the transitive dependency of Listprice. 3NF decomposition: Book1(BookTitle, AuthorName) Book2A(BookTitle, BookType, Publisher) Book2B(BookType, ListPrice) Book3(AuthorName, AuthorAffiliation) The relations are also in BCNF.

Chapter 10 Tutorial8 Exercise 4 Consider a relation R(A, B, C, D, E) with the following dependencies: AB  C B  D C  B A  E a. Specify the key of R. b. Decompose the relation into a set of 3NF relations. c. Decompose the relation into a set of BCNF relations. d. Why might one want to stop at 3NF and not decompose further to BCNF.

Chapter 10 Tutorial9 Exercise 4 a. Specify the key of R. A and B b. Decompose the relation into a set of 3NF relations. R1(A, B, C) R2(B, D) R3(A, E) c. Decompose the relation into a set of BCNF relations. R1(A, C) R2(C, B) R2(B, D) R3(A, E)

Chapter 10 Tutorial Exercise 4 d. Why might one want to stop at 3NF and not decompose further to BCNF. The reason that 3NF is sometimes preferred is that it allows one to preserve each FD in a minimal cover of FDs within one relation, which allows these constraints to be checked more easily. 10