Normalization and Databases

Slides:



Advertisements
Similar presentations
Relational Database Systems Higher Information Systems.
Advertisements

Normalisation.
Lecture – 5 Course Code – MIS4102.  Edgar F. Codd, the inventor of the relational model, introduced the concept of normalization and what we now know.
Ingredients: - 1/4 cup butter (dairy) - 1 cup brown sugar (spice) - 1/2 teaspoon cinnamon (spice) - 1/4 cup banana liqueur (alcohol) - 4 bananas, cut in.
WJEC Applied ICT Databases – Attributes & Entities Normalisation It is important in Database Design to make sure that the correct attributes are grouped.
Normalisation Ensuring data integrity in database design 1.
ISP 121 Access Normalization and Relationships. Normalization Say we’re operating a pet day-care and we need to keep information on our pets/customers.
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.
CS263:Revision on Normalisation
Designing a Database Unleashing the Power of Relational Database Design.
1 NORMALISATION. 2 Introduction Overview Objectives Intro. to Subject Why we normalise 1, 2 & 3 NF Normalisation Process Example Summary.
Project and Data Management Software
Normalization A337. A337 - Reed Smith2 Structure What is a database? ◦ Tables of information  Rows are referred to as records  Columns are referred.
Data Model Examples USER SPECIFICATIONS.
Database Normalization CP3410 Daryle Niedermayer, I.S.P., PMP.
The Relational Database Model CST272. Return Creating the Unnormalized Table n List the fields n Select a primary key – The field (or concatenation of.
Relational Database Concepts. Let’s start with a simple example of a database application Assume that you want to keep track of your clients’ names, addresses,
Richard Merritt1 Data Modelling Entities, Attributes and Relationships.
Avoiding Database Anomalies
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities.
Normalisation Mia’s Sandwich Shop The Process Explained.
Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database.
Module Coordinator Tan Szu Tak School of Information and Communication Technology, Politeknik Brunei Semester
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.
Group 6. What is data redundancy? Data redundancy occurs in database systems which have a field that is repeated in two or more tables... Data redundancy.
1 5 Chapter 5 Database Design 1: Some Normalization Examples Spring 2006.
Quiz questions. 1 A data structure that is made up of fields and records? Table.
A337 - Reed Smith1 Structure What is a database? –Table of information Rows are referred to as records Columns are referred to as fields Record identifier.
Chapter 56 Relational Database Design Compiled by Eddie Moorcroft.
MIS2502: Data Analytics Relational Data Modeling
Sample Table Standard Notation Entity name in uppercase
Databases Database Normalisation. Learning Objectives Design simple relational databases to the third normal form (3NF).
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.
Flat file and relational databases Flat file database In a flat file database information is held in a single table. Student IDStudent name GenderDOBCourse.
Normalization.
Revised: 2 April 2004 Fred Swartz
Basic Database Design COSC 2328 – Web Programming.
MIS2502: Data Analytics Relational Data Modeling
Database Normalization
Chapter 6 Data flow diagramming ACCOUNTING INFORMATION SYSTEMS
Functional Dependencies
Database Relationships
Payroll Management System
Design a Relational Database Identify Database Purpose
Databases A brief introduction….
Do it now – PAGE 13 You will find your do it now task in your workbook – look for the start button! Thursday, 20 September 2018.
Examples of normalization
Entity relationship diagrams
Database Design ERD and Normalisation
5.02 Understand database queries, forms, and reports used in business.
MIS2502: Data Analytics Converting ERDs to Schemas
Normalization A337.
Chapter 4.1 V3.0 Napier University Dr Gordon Russell
Normalization – Part II
Some Normalization Examples
Examples of normalization
Microsoft Applications
CS 3630 Database Design and Implementation
Chapter 8 – Part2 Database Design.
Lesson Objectives Aims You should know about: 1.3.2:
Chapter 8 – Part2 Database Design.
Database Normalization.
Chapter 14 Normalization Pearson Education © 2009.
MIS2502: Data Analytics Relational Data Modeling 3
Normalisation 1 Unit 3.1 Dr Gordon Russell, Napier University
Data Base.
Normalisation Un-normalised Data (UNF or 0NF) Data Attributes:
Some Normalization Examples
Presentation transcript:

Normalization and Databases Asfia Rahman

What is? process of structuring data within a database. The process starts with a flat file and finishes with a set of related tables. UNF / 0NF 1NF 2NF 3NF

0NF Unnormalised form a flat file. contain non-atomic data, repeating groups of data and possibly redundant data. Non-atomic data is where a field contains more than one item of data. Repeating groups of data is when fields are repeated for each record or a record appears to have more than one set of data for a group of fields. Redundant data exists when data is repeated unnecessarily. This can be spotted when data can be identified by knowing it is dependent upon another field.

Examples of redundant data and non-atomic data

Examples of repeating and more than 1 set of data (also non-atomic)

1 NF all fields must contain atomic data (1 item only) there must be no repeating groups of data there must be a unique key.

Changing 0nf to 1nf Non-atomic Data (one field has more than 1 item) Order ID Order Date Customer ID Customer Name Customer Address Product Code Product name Quantity Price 3847 12/9/16 1224 Baker Jones Somewhere, city 1212 1232 Marzipan Flour 1 2 $1.50 $0.75 2320 15/10/16 2342 Emma W Someplace,, cityW 2343 Sugar Eggs 3 6 $0.83 $0.15 Non-atomic Data (one field has more than 1 item) Redundant data ( price is repeated every time the product comes)

How to do it? Split any repeating group of data into a separate table Add the key of the original table to act as a foreign key. Order ID Order Date Customer ID Customer Name Customer Address Product Code Product name Quantity Price 3847 12/9/16 1224 Baker Jones Somewhere, city 1212 1232 Marzipan Flour 1 2 $1.50 $0.75 2320 15/10/16 2342 Emma W Someplace,, cityW 2343 Sugar Eggs 3 6 $0.83 $0.15 Compound key Order ID Product Code Product name Quantity Price 3847 1212 Marzipan 1 $1.50 1232 Flour 2 $0.75 2320 3 2342 Sugar $0.83 2343 Eggs 6 $0.15 Order ID Order Date Customer ID Customer Name Customer Address 3847 12/9/16 1224 Baker Jones Somewhere, city 2320 15/10/16 2342 Emma W Someplace,, cityW

2 NF No partial key dependencies Means no non-key fields can be dependent upon part of a primary key. only applies to tables with compound Keys These fields and that part of the compound key will form a new table.

1nf to 2nf 1 Product Code Product name Price 1212 Marzipan $1.50 1232 Flour $0.75 2342 Sugar $0.83 2343 Eggs $0.15 Order ID Product Code Product name Quantity Price 3847 1212 Marzipan 1 $1.50 1232 Flour 2 $0.75 2320 3 2342 Sugar $0.83 2343 Eggs 6 $0.15 2 Order ID Product Code Quantity 3847 1212 1 1232 2 2320 3 2342 2343 6 Split out data dependent on only part of a composite key Add the key of the original table to act as a foreign key. The PK for the table made will have a CK made up from the original PK along with the main identifier for that group.

3NF no non-key dependencies. No fields that are dependent upon another field that is not a primary key

2nf to 3nf Split out data dependent on a non-key field Foreign key will be the non-key field left behind. Order ID Order Date Customer ID 3847 12/9/16 1224 2320 15/10/16 2342 Order ID Order Date Customer ID Customer Name Customer Address 3847 12/9/16 1224 Baker Jones Somewhere, city 2320 15/10/16 2342 Emma W Someplace,, cityW 2 1 Customer ID Customer Name Customer Address 1224 Baker Jones Somewhere, city 2342 Emma W Someplace,, cityW

Final Tables Product Code Product name Price 1212 Marzipan $1.50 1232 Flour $0.75 2342 Sugar $0.83 2343 Eggs $0.15 Order ID Product Code Quantity 3847 1212 1 1232 2 2320 3 2342 2343 6 Customer ID Customer Name Customer Address 1224 Baker Jones Somewhere, city 2342 Emma W Someplace,, cityW Order ID Order Date Customer ID 3847 12/9/16 1224 2320 15/10/16 2342