Databases : Design of Relational Database Schemas 2007, Fall Pusan National University Ki-Joune Li.

Slides:



Advertisements
Similar presentations
Normalisation to 3NF Database Systems Lecture 11 Natasha Alechina.
Advertisements

Spring 2011 Instructor: Hassan Khosravi
Boyce-Codd NF Takahiko Saito Spring 2005 CS 157A.
Normalization CMSC 461 Michael Wilson. Anomalies  Poor relational database design can lead to the occurrence of anomalies  Anomalies that we tend to.
Boyce-Codd normal form (BCNF) Kai Zhu CS157B Professor: Dr. Lee.
Normalization continued CMSC 461 Michael Wilson. Normalization clarification  Normalization is simply a way of reducing anomalous database behavior 
Ch 10, Functional Dependencies and Normal forms
Functional Dependencies and Normalization for Relational Databases.
INLS 623 – D ATABASE N ORMALIZATION Instructor: Jason Carter.
Normal Forms By Christopher Archibald October 16 th 2007.
Lossless Decomposition (2) Prof. Sin-Min Lee Department of Computer Science San Jose State University.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 227 Database Systems I Design Theory for Relational Databases.
Midterm Review II. Redundancy. –Information may be repeated unnecessarily in several tuples. –E.g. length and filmType. Update anomalies. –We may change.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 8 A First Course in Database Systems.
Decomposition By Timothy Chen CS157A. Goal to Decomposition Eliminate redundancy by decomposing a relation into several relations in a higher normal form.
Closure The closure of {B 1 …B k } under the set of FDs S, denoted by {B 1 …B k } +, is defined as follows: {B 1 …B k } + = {B | any relation satisfies.
Need for Normalization
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
The Relational Data Model. Why Relational Model? Most of the current DBMS are based on the relational data model: –simplicity –mathematically based: expressions.
The principal problem that we encounter is redundancy, where a fact is repeated in more than one tuple. Most common cause: attempts to group into one relation.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
CS 3630 Database Design and Implementation. First Normal Form (1NF) No multi-value attributes Done when mapping E-R model to relational schema DBDL 2.
Chapter 8 Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Lecture 12 Inst: Haya Sammaneh
Database Management COP4540, SCS, FIU Relation Normalization (Chapter 14)
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,...,
King Saud University College of Computer & Information Sciences Computer Science Department CS 380 Introduction to Database Systems Functional Dependencies.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Normalization for Relational Databases.
Database Normalization.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Chapter 7 1 Database Principles Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that.
Design Theory for Relational Databases 2015, Fall Pusan National University Ki-Joune Li.
Functional Dependencies and Normalization for Relational Databases.
Customer Order Order Number Date Cust ID Last Name First Name State Amount Tax Rate Product 1 ID Product 1 Description Product 1 Quantity Product 2 ID.
Revisit FDs & BCNF Normalization 1 Instructor: Mohamed Eltabakh
1 Functional Dependencies and Normalization Chapter 15.
1 IT 244 Database Management System Topic 7 The Relational Data Model Functional Dependencies Ref : -A First Course in Database System (Jeffrey D Ullman,
© D. Wong Ch. 3 (continued)  Database design problems  Functional Dependency  Keys of relations  Decompositions based on Functional Dependency.
NORMALIZATION COSC 6340 Spring Objective Normalization presents a set of rules that tables and databases must follow to be well structured. Historically.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Dr. Mohamed Osman Hegaz1 Logical data base design (2) Normalization.
More Relation Operations 2015, Fall Pusan National University Ki-Joune Li.
Normalization MIS335 Database Systems. Why Normalization? Optimizing database structure Removing duplications Accelerating the instructions Data integrity!
Chapter 5.1 and 5.2 Brian Cobarrubia Database Management Systems II January 31, 2008.
3 Spring Chapter Normalization of Database Tables.
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.
Brian Thoms.  Databases normalization The systematic way of ensuring that a database structure is suitable for general-purpose querying and free of certain.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 5 Introduction to a First Course in Database Systems.
Normalisation 1NF to 3NF Ashima Wadhwa. In This Lecture Normalisation to 3NF Data redundancy Functional dependencies Normal forms First, Second, and Third.
© D. Wong Functional Dependencies (FD)  Given: relation schema R(A1, …, An), and X and Y be subsets of (A1, … An). FD : X  Y means X functionally.
Databases : Functional Dependencies 2007, Fall Pusan National University Ki-Joune Li.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Week 4 Lecture Part 1 of 3 Normalization of Database Tables Samuel ConnSamuel Conn, Asst. Professor.
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.
Database Architecture Normalization. Purpose of Normalization A technique for producing a set of relations with desirable properties, given the data requirements.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
Normalization Or theoretical and common sense approaches to redesigning a database.
COP 6726: New Directions in Database Systems
CS422 Principles of Database Systems Normalization
CS422 Principles of Database Systems Normalization
Normal forms First Normal Form (1NF) Second Normal Form (2NF)
Design Theory for Relational Databases
Chapter 14 & Chapter 15 Normalization Pearson Education © 2009.
Normalization.
Design Theory for Relational Databases
Presentation transcript:

Databases : Design of Relational Database Schemas 2007, Fall Pusan National University Ki-Joune Li

STEMPNU 2 Bad Design: Anomalies Bad Design: Example Redundancy Update Anomaly Deletion Anomaly TitleYearLengthFilm TypeStudioNameStarName Star Wars ColorFoxCarrie Fisher Star Wars ColorFoxMark Hamill Star Wars ColorFoxHarrison Ford Mighty Ducks ColorDisneyEmilio Estevez Wayne’s World199295ColorParamountDana Carvey Wayne’s World199295ColorParamountMike Meyers

STEMPNU 3 Decomposing Relations Decomposition of Bad Relation  A good way to remove the problem of bad relations Decomposition: Lossless Decomposition  { A 1 A 2 … A n }  { B 1 B 2 … B m }, {C 1 C 2 … C k } such that { B 1 B 2 … B m }  {C 1 C 2 … C k } = { A 1 A 2 … A n } and { B 1 B 2 … B m }  {C 1 C 2 … C k }  {}

STEMPNU 4 Decomposing Relations: Example R={title, year, length, filmType, studioName, starName}  {title, year, length, filmType, studioName} (=R1), {title, year, starName} (=R2) Redundancy Update Anomaly Deletion Anomaly TitleYearLengthFilm TypeStudioName Star Wars ColorFox Mighty Ducks ColorDisney Wayne’s World199295ColorParamount TitleYearStarName Star Wars1977Carrie Fisher Star Wars1977Mark Hamill Star Wars1977Harrison Ford Mighty Ducks1991Emilio Estevez Wayne’s World1992Dana Carvey Wayne’s World1992Mike Meyers

STEMPNU 5 Normal Form: Conditions for Good Relation 1 st Normal Form (1NF) 2 nd Normal Form (2NF) 3 rd Normal Form (3NF) Boyce-Codd Normal Form (BCNF)

STEMPNU 6 1 st Normal Form 1NF: Every component of relation should be ATOMIC  No Table in component  No Set  No List etc..

STEMPNU 7 2 nd Normal Form 2NF  1NF and  None of the non-prime attributes of the relation is FD on a part of a candidate key Partial Dependency on non-prime attribute Example  Player (Team, Number, TeamAddress, Name, Position)  1NF but not 2NF B CA

STEMPNU 8 Example EmployeeSkillCurrent Work Location JonesTyping114 Main Street JonesShorthand114 Main Street JonesWhittling114 Main Street RobertsLight Cleaning73 Industrial Way EllisAlchemy73 Industrial Way EllisJuggling73 Industrial Way HarrisonLight Cleaning73 Industrial Way Candidate Key: {Employee, Skill} Not 2ND  Partial FD: Employee  Current Work Location  Should be decomposed (Employee, Skill), (Employee, Current Work Location)

STEMPNU 9 3 rd Normal Form 2NF: Every non-prime attributes of the relation must be non-transitively dependent on every candidate key Example  Team (TeamName, Address, Manager SS ID, ManagerHireDate)  2NF but Not 3NF: TeamName  Manager SS ID  ManagerHireDate  To be decomposed (TeamName, Address, ManagerID), (Manager SS ID, ManagerHireDate) B CA

STEMPNU 10 Example: 2NF but NOT 3NF TournamentYearWinnerWinner Date of Birth Indiana Invitational1998Al Fredrickson21 July 1975 Cleveland Open1999Bob Albertson28 September 1968 Des Moines Masters1999Al Fredrickson21 July 1975 Indiana Invitational1999Chip Masterson14 March 1977 Candidate Key: {Tournament, Year} 2NF: No Partial Dependency Not 3ND  Transitive Functional Dependency  {Tournament, Year}  Winner  Winner Date of Birth  Should be decomposed (Tournament, Year, Winner), (Player, Birth date}

STEMPNU 11 Boyce-Codd Normal Form (BCNF) BCNF: For every one of its non-trivial functional dependencies X  Y, X is a super key  Remember: nontrivial means A is not a member of set X.  Remember, a superkey is any superset of a key (not necessarily a proper superset) BCNF is slightly stronger than 3NF

STEMPNU 12 1NF 2NF 3NF Relationship between 1NF, 2NF, 3NF and BCNF BCNF

STEMPNU 13 Example: 3NF but NOT BCNF Prof. IDProf. SS IDStudent ID A table to show the assignment of students Candidate Keys  {Prof. ID, Student ID}  {Prof. SS ID, Student ID} 1NF 2NF: no partial FD on non-prime attributes on candidate key 3NF: No transitive FD NOT BCNF:  Prof. ID  Prof. SS ID : Functional Dependency but not candidate key  Should be decomposed (Prof. ID, Student ID), (Prof. ID, Prof. SS ID)