Tutorial 6: normalize the following relation to 1NF, 2NF, and 3NF TransIDRentDateCustomerIDLastNamePhoneAddressVideoIDCopy#TitleRent 14/18/043Washington502-777-757595.

Slides:



Advertisements
Similar presentations
Normalisation.
Advertisements

1 Database Management Systems Chapter 1 Introduction.
1 Class Agenda (04/03 and 04/08)  Review and discuss HW #8 answers  Present normalization process Enhance conceptual knowledge of database design. Improve.
Normalisation Ensuring data integrity in database design 1.
Athabasca University Under Development for COMP 200 Gary Novokowsky
Accounting 6500 Relational Databases: Accounting Applications Introduction to Normalization.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Normalization Practice Yong Choi BPA CSUB. 1NF Customer_IDNameAddressCompany Name 104Mr. Ray Suchecki 123 Pond Hill Road, Detroit, MI, CSUB 624Mr.
Database Management Systems
Announcements n Difference between “excused” and “absent” n Office hours next week May not be here Monday Tuesday: 1:00 to 2:00 Wednesday: 10:00 to 11:00.
Database Design Concepts Lecture 19 Term 2 week 8 Worked example of normalisation.
Relational Data Analysis II. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance.
Cours 5,6: Optimisation de requêtes & Normalisation de bases de données Tuanloc NGUYEN Miage de Paris 12.
Why Normalization? To Reduce Redundancy to 1.avoid modification, insertion, deletion anomolies 2.save space Goal: One Fact in One Place.
Terms - data,information, file record, table, row, column, transaction, concurrency Concepts - data integrity, data redundancy, Type of databases – single-user,
Normalization of Tables “Between two evils, choose neither; between two goods, choose both.” Tryon Edwards.
Jerry Post Copyright © Database Management Systems Chapter 3 Data Normalization.
1 Copyright © 2010 Jerry Post. All rights reserved. Data Normalization (1) IS240 – DBMS Lecture # 4 – M. E. Kabay, PhD, CISSP-ISSMP Assoc. Prof.
VCE IT Theory Slideshows
CREATE THE DIFFERENCE Normalisation (special thanks to Janet Francis for this presentation)
1 Class Agenda (04/09 through 04/16)  Review HW #8  Present normalization process Enhance conceptual knowledge of database design. Improve practical.
1 Class Agenda (11/07 and 11/12)  Review HW #8 answers  Present normalization process Enhance conceptual knowledge of database design. Improve practical.
Relational databases and third normal form As always click on speaker notes under view when executing to get more information!
Database Development and Data Normalization. 2 What is a Database and a DBMS?  Database  A collection of data stored in a standardized format, designed.
University of Manitoba Asper School of Business 3500 DBMS Bob Travica
Avoiding Database Anomalies
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities.
Module Title? DBMS Normalization. Module Title? DBMS Normalization  Normalization is the process of removing redundant data from tables in order to improve.
RDBMS Concepts/ Session 3 / 1 of 22 Objectives  In this lesson, you will learn to:  Describe data redundancy  Describe the first, second, and third.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
Your name here. Improving Schemas and Normalization What are redundancies and anomalies? What are functional dependencies and how are they related to.
Copyright Ó Oracle Corporation, All rights reserved. Normalization Use the student note section below for further explanation of the slide content.Use.
Database Normalization Lynne Weldon July 17, 2000.
CORE 2: Information systems and Databases NORMALISING DATABASES.
DBSYSTEMS Chapter 3 Data Normalization Get data properly tabled! Based on G. Post, DBMS: Designing & Building Business Applications University of Manitoba.
Data Models and Relational Databases Chapter 2. Learning Objectives Identify primary and foreign keys for each entity and relevant relationships in the.
Normalization Information Systems II Ioan Despi. Informal approach Building a database structure : A process of examining the data which is useful & necessary.
1 5 Normalization. 2 5 Database Design Give some body of data to be represented in a database, how do we decide on a suitable logical structure for that.
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.
SYSTEMSDESIGNANALYSIS 1 Chapter 17 Data Modeling Jerry Post Copyright © 1997.
M1G Introduction to Database Development 4. Improving the database design.
ITN Table Normalization1 ITN 170 MySQL Database Programming Lecture 3 :Database Analysis and Design (III) Normalization.
1 5 Chapter 5 Database Design 1: Some Normalization Examples Spring 2006.
In this session, you will learn to: Describe data redundancy Describe the first, second, and third normal forms Describe the Boyce-Codd Normal Form Appreciate.
Database Design Normalisation. Last Session Looked at: –What databases were –Where they are used –How they are used.
Normalization.
MIS2502: Data Analytics Relational Data Modeling
Data modeling Process. Copyright © CIST 2 Definition What is data modeling? –Identify the real world data that must be stored on the database –Design.
Sample Table Standard Notation Entity name in uppercase
Normalisation 1NF to 3NF Ashima Wadhwa. In This Lecture Normalisation to 3NF Data redundancy Functional dependencies Normal forms First, Second, and Third.
Logical Database Design and Relational Data Model Muhammad Nasir
What Is Normalization  In relational database design, the process of organizing data to minimize redundancy  Usually involves dividing a database into.
MS Access. Most A2 projects use MS Access Has sufficient depth to support a significant project. Relational Databases. Fairly easy to develop a good user.
Normalisation Unit 6: Databases. Just to recap  What is an Entity  What is an Attribute?
Lecture # 17 Chapter # 10 Normalization Database Systems.
Normalisation FORM RULES 1NF 2NF 3NF. What is normalisation of data? The process of Normalisation organises your database to: Reduce or minimise redundant.
Normalisation Worked example for an Order Remember : The data should depend upon the key, the whole key and nothing but the key.
Relational Databases – Further Study I think we’ve covered all you need to know for GCSE about relational databases I’m not aware of any practical coursework.
Announcements n Difference between “excused” and “absent” n Office hours next week May not be here Monday Tuesday: 1:00 to 2:00 Wednesday: 10:00 to 11:00.
Data Base Design Steps 1.Define Entity Classes (Relations/Tables) and Keys. 2.Define Relationships between Entity Classes. Normalization Steps Eliminate.
1 Data Normalization Text book Chapter 3: Jerry Post Copyright © 2003.
Database Management Systems
Data Normalization (1) IS240 – DBMS Lecture # 4 –
INLS 623 – Database Normalization
Revised: 2 April 2004 Fred Swartz
Get data properly tabled!
Entity relationship diagrams
Normalization Practice
Normalization Practice ANS
Normalization Practice
Presentation transcript:

Tutorial 6: normalize the following relation to 1NF, 2NF, and 3NF TransIDRentDateCustomerIDLastNamePhoneAddressVideoIDCopy#TitleRent 14/18/043Washington Easy Street122001: A Space Odyssey$ /18/04 3Washington Easy Street63Clockwork Orange$ /30/04 7Lasater S. Ray Drive81Hopscotch$ /30/04 7Lasater S. Ray Drive21Apocalypse Now$ /30/04 7Lasater S. Ray Drive61Clockwork Orange$ /18/048Jones Lakeside Drive91Luggage Of The Gods$ /18/04 8Jones Lakeside Drive151Fabulous Baker Boys$ /18/04 8Jones Lakeside Drive41Boy And His Dog$ /18/043Washington Easy Street31Blues Brothers$ /18/04 3Washington Easy Street81Hopscotch$ /18/04 3Washington Easy Street131Surf Nazis Must Die$ /18/043Washington Easy Street171Witches of Eastwick$2.00 RentalForm(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode, Video(VideoID, Copy#, Title, Rent ) )

First Normal Form RentalForm(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode, (VideoID, Copy#, Title, Rent ) ) RentalForm2(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode) RentalLine(TransID, VideoID, Copy#, Title, Rent ) u Remove repeating sections –Split into two tables –Bring key from main and repeating section u RentalLine(TransID, VideoID, Copy#,...) –Each transaction can have many videos (key VideoID) –Each video can be rented on many transactions (key TransID) –For each TransID and VideoID, only one Copy# (no key on Copy#)

1NF: TransID RentDateCustIDPhoneLastNameFirstNameAddressCityStateZipCode 14/18/ WashingtonElroy95 Easy StreetSmith's GroveKY /30/ LasaterLes67 S. Ray DrivePortlandTN /18/ JonesCharlie867 Lakeside DriveCastalian SpringsTN /18/ WashingtonElroy95 Easy StreetSmith's GroveKY42171 TransIDVideoIDCopy#TitleRent : A Space Odyssey$ Clockwork Orange$ Hopscotch$ Apocalypse Now$ Clockwork Orange$ Luggage Of The Gods$ Fabulous Baker Boys$ Boy And His Dog$ Blues Brothers$ Hopscotch$ Surf Nazis Must Die$ Witches of Eastwick$2.00

Second Normal Form Definition u Each non-key column must depend on the entire key. –Only applies to concatenated keys –Some columns only depend on part of the key –Split those into a new table. RentalLine(TransID, VideoID, Copy#, Title, Rent) Depend only on VideoID Depends on both TransID and VideoID

Second Normal Form Example u Title depends only on VideoID –Each VideoID can have only one title u Rent depends on VideoID –This statement is actually a business rule. –It might be different at different stores. –Some stores might charge a different rent for each video depending on the day (or time). u Each non-key column depends on the whole key. RentalLine(TransID, VideoID, Copy#, Title, Rent) VideosRented(TransID, VideoID, Copy#) Videos(VideoID, Title, Rent)

Second Normal Form Example (Data) TransIDVideoIDCopy# VideoIDTitleRent 12001: A Space Odyssey$1.50 2Apocalypse Now$2.00 3Blues Brothers$2.00 4Boy And His Dog$2.50 5Brother From Another Planet$2.00 6Clockwork Orange$1.50 7Gods Must Be Crazy$2.00 8Hopscotch$1.50 VideosRented(TransID, VideoID, Copy#) Videos(VideoID, Title, Rent) RentalForm2(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode) (Unchanged)

Second Normal Form Problems (Data) TransIDRentDateCustIDPhoneLastNameFirstNameAddressCityStateZipCode 14/18/ WashingtonElroy95 Easy StreetSmith's GroveKY /30/ LasaterLes67 S. Ray DrivePortlandTN /18/ JonesCharlie867 Lakeside DriveCastalian SpringsTN /18/ WashingtonElroy95 Easy StreetSmith's GroveKY42171 RentalForm2(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode) u Even in 2NF, problems remain –Redundancy (Replication) –Hidden dependency –If a customer has not rented a video yet, where do we store their personal data? u Solution: split table.

Third Normal Form Definition RentalForm2(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode) u Each non-key column must depend on nothing but the key. –Some columns depend on columns that are not part of the key. –Split those into a new table. –Example: Customers name does not change for every transaction. u Dependence (definition) –If given a value for the key you always know the value of the property in question, then that property is said to depend on the key. –If you change the key and the questionable property does not change, then the table is not in 3NF. Depend only on CustomerID Depend on TransID

Third Normal Form Example u Customer attributes depend only on Customer ID –Split them into new table (Customer) –Remember to leave CustomerID in Rentals table. –We need to be able to reconnect tables. u 3NF is sometimes easier to see if you identify primary objects at the start--then you would recognize that Customer was a separate object. RentalForm2(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode) Rentals(TransID, RentDate, CustomerID ) Customers(CustomerID, Phone, Name, Address, City, State, ZipCode )

Third Normal Form Example Data TransIDRentDateCustomerID 14/18/ /30/ /18/048 44/18/043 CustomerIDPhoneLastNameFirstNameAddressCityStateZipCode JohnsonMartha125 Main StreetAlvatonKY SmithJack873 Elm StreetBowling GreenKY WashingtonElroy95 Easy StreetSmith's GroveKY AdamsSamuel746 Brown DriveAlvatonKY RabitzVictor645 White AvenueBowling GreenKY SteinmetzSusan15 Speedway DrivePortlandTN LasaterLes67 S. Ray DrivePortlandTN JonesCharlie867 Lakeside DriveCastalian TN ChavezJuan673 Industry Blvd.CaneyvilleKY RojoMaria88 Main StreetCave CityKY42127 Rentals(TransID, RentDate, CustomerID ) Customers(CustomerID, Phone, Name, Address, City, State, ZipCode ) VideosRented(TransID, VideoID, Copy#) Videos(VideoID, Title, Rent) RentalForm2(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode

Exercise : Put the following on the 1NF, 2NF and 3NF