Daniel AdinugrohoDatabase Programming 1 DATABASE PROGRAMMING Lecture on 29 – 04 – 2005.

Slides:



Advertisements
Similar presentations
5 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Advertisements

Ch 10, Functional Dependencies and Normal forms
Functional Dependencies and Normalization for Relational Databases.
The Relational Model System Development Life Cycle Normalisation
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
Chapter 8 Normal Forms Based on Functional Dependencies Deborah Costa Oct 18, 2007.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
1 5 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 5 Database Design: Normalization.
Normalization of Database Tables
1 NORMALISATION. 2 Introduction Overview Objectives Intro. to Subject Why we normalise 1, 2 & 3 NF Normalisation Process Example Summary.
Normalization I.
Chapter 5 Normalization Transparencies © Pearson Education Limited 1995, 2005.
Chapter 5 Normalization of Database Tables
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 5 Normalization of Database Tables.
1 5 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 5 Database Design 1: Normalization.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Normalization Quiz Tao Li Grant Horntvedt. 1. Which of the following statements is true: a. Normal forms can be derived by inspecting the data in various.
Chapter 5 Normalization of Database Tables
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Lecture 12 Inst: Haya Sammaneh
A Guide to SQL, Eighth Edition Chapter Two Database Design Fundamentals.
Concepts and Terminology Introduction to Database.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 4 This material was developed by Oregon Health & Science.
NormalizationNormalization Chapter 4. Purpose of Normalization Normalization  A technique for producing a set of relations with desirable properties,
Database Systems: Design, Implementation, and Management Tenth Edition
Concepts of Database Management Sixth Edition Chapter 5 Database Design 1: Normalization.
Concepts of Database Management, Fifth Edition
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables.
Normalization. Learners Support Publications 2 Objectives u The purpose of normalization. u The problems associated with redundant data.
1 A Guide to MySQL 2 Database Design Fundamentals.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
Normalization Transparencies
Schema Refinement and Normal Forms 20131CS3754 Class Notes #7, John Shieh.
THIRD NORMAL FORM (3NF) A relation R is in BCNF if whenever a FD XA holds in R, one of the following statements is true: XA is a trivial FD, or X is.
1 A Guide to MySQL 2 Database Design Fundamentals.
Chapter 13 Normalization Transparencies. 2 Chapter 13 - Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification.
CS370 Spring 2007 CS 370 Database Systems Lecture 4 Introduction to Database Design.
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
CSE314 Database Systems Basics of Functional Dependencies and Normalization for Relational Databases Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E.
Lecture 5 Normalization. Objectives The purpose of normalization. How normalization can be used when designing a relational database. The potential problems.
Chapter 13 Normalization Transparencies Last Updated: 08 th May 2011 By M. Arief
Chapter 10 Normalization Pearson Education © 2009.
Rules of Database Normalization
9/23/2012ISC329 Isabelle Bichindaritz1 Normalization.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
Concepts of Database Management Seventh Edition Chapter 5 Database Design 1: Normalization.
Daniel AdinugrohoDatabase Programming 1 DATABASE PROGRAMMING Lecture on 04 – 05 – 2005.
Chapter 5.1 and 5.2 Brian Cobarrubia Database Management Systems II January 31, 2008.
Chapter 10 Designing Databases. Objectives:  Define key database design terms.  Explain the role of database design in the IS development process. 
Ch 7: Normalization-Part 1
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 19.
Normalization. Overview Earliest  formalized database design technique and at one time was the starting point for logical database design. Today  is.
Week 4 Lecture Part 1 of 3 Normalization of Database Tables Samuel ConnSamuel Conn, Asst. Professor.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
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.
Chapter 8 Relational Database Design Topic 1: Normalization Chuan Li 1 © Pearson Education Limited 1995, 2005.
A Guide to SQL, Eighth Edition
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Chapter 6 Normalization of Database Tables
Chapter 14 Normalization – Part I Pearson Education © 2009.
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
1st, 2nd, and 3rd Normal Forms
Presentation transcript:

Daniel AdinugrohoDatabase Programming 1 DATABASE PROGRAMMING Lecture on 29 – 04 – 2005

Daniel AdinugrohoDatabase Programming 2 PREVIOUS LECTURE 1. Review of Introduction to Database – History of database 2. Review of Database Design – Table, Primary and Foreign Key – Simple database design 3. Introduction to Normalization – Why we need normalization – Applying normalization

Daniel AdinugrohoDatabase Programming 3 OVERVIEW OF DB DESIGN The database design can be divided into 6 steps: 1. Requirement Analysis 2. Conceptual Database Design 3. Logical Database Design 4. Schema Refinement 5. Physical Database Design 6. Security Design

Daniel AdinugrohoDatabase Programming 4 1. REQUIREMENT ANALYSIS This is a very first step in designing database application to understand: ● what data is stored in the database, ● what applications is built on top of it, ● what operations are most frequent and ● subject to performance requirements Usually informal meeting process that includes discussions with prospecting users and managements.

Daniel AdinugrohoDatabase Programming 5 2. CONCEPTUAL DB DESIGN The information gathered from the previous step is used to developed a high level description of data to be stored in the database, along with constraint that are known to hold over this data. Usually we use high level data model, such as ER (Entity Relationship) model. ER Diagram will be discussed further in RDBMS subject.

Daniel AdinugrohoDatabase Programming 6 3. LOGICAL DB DESIGN We choose DBMS (Database Management System) to implement our database design, and convert the conceptual database design into a database schema in the data model of chosen DBMS. Basically, in this step we convert an ER schema into a relational database schema. We should use Relational Database Management System (RDBMS) to make it easier in converting process.

Daniel AdinugrohoDatabase Programming 7 4. SCHEMA REFINEMENT Analyze the collections of relations in relational database schema to identify potential problems, and to refine it. One of the well-known concept is Normalization. We will discuss Normalization today.

Daniel AdinugrohoDatabase Programming 8 5. PHYSICAL DB DESIGN We must consider typical expected workloads that our database must support and further refine the database design to ensure that it meets desired performance criteria. It may involve building indexes on some tables and clustering some tables.

Daniel AdinugrohoDatabase Programming 9 6. SECURITY DESIGN Identify different users and roles and which part of database (in this case tables) allowed or denied to be accessed by a particular users/roles. Example in a supermarket: Operator only able to input data. Supervisor can input, modify and delete data. Manager can do everything supervisor can do plus can see the pricing.

Daniel AdinugrohoDatabase Programming 10 SCHEMA REFINEMENT Main problem in designing a database: REDUNDANCY! REDUNDANCY Cause: ● Redundant storage: information is stored repeatedly ● Update anomalies: inconsistency aroused if one of similar data is updated ● Insertion anomalies: inconsistency aroused if only some information is stored ● Deletion anomalies: inconsistency aroused if only delete some information Redundancy can be eliminated by decomposition. However, it should be used with caution.

Daniel AdinugrohoDatabase Programming 11 DECOMPOSITIONS Decomposition: a process to replace a relation with a collection of smaller relations. Example: Hourly_Emps(ssn,name,lot,rating,hourly_wages,hours_worked) It can be decomposed to Hourly_Emps2(ssn,name,lot,rating,hours_worked) Wages(rating,hourly_wages)

Daniel AdinugrohoDatabase Programming 12 DECOMPOSITION(2) Decomposition can lead to more problems, if we are not careful. Two important questions when decomposing relations: 1. Do we need to decompose a relation? -> Normal Forms 2. What problem (if any) does a given decomposition cause? -> lossless-join property, dependency preservation property

Daniel AdinugrohoDatabase Programming 13 NORMAL FORMS Normal forms: is a formal definition about the way data is stored in the database. In total, we have: ● First Normal Form (1NF) ● Second Normal Form (2NF) ● Third Normal Form (3NF) ● Boyce-Codd Normal Form (BCNF) ● Fourth Normal Form (4NF) ● Five Normal Form (5NF) Only the first three is commonly used.

Daniel AdinugrohoDatabase Programming 14 NORMAL FORMS CASE STUDY Case study: Project number Project name 1-n Employee numbers (1-n indicates that there are many occurrences of this field - it is a repeating group) 1-n Employee names 1-n Rate categories 1-n Hourly rates

Daniel AdinugrohoDatabase Programming 15 FIRST NORMAL FORM (1NF) 1NF -> eliminate repeating attributes 1. Identify repeating attributes. 2. All the key attributes are defined. 3. All attributes are dependent on the primary key. Employee project table Project number - primary key Project name Employee number - primary key Employee name Rate category Hourly rate This table is in 1st normal form.

Daniel AdinugrohoDatabase Programming 16 SECOND NORMAL FORM (2NF) 1. It's in first normal form (1NF) 2. It includes no partial dependencies (where an attribute is dependent on only a part of a primary key). Employee project table Project number - primary key Employee number - primary key Employee table Employee number - primary key Employee name Rate category Hourly rate Project table Project number - primary key Project name The table is now in 2nd normal form

Daniel AdinugrohoDatabase Programming 17 THIRD NORMAL FORM (3NF) 1. It's in second normal form (2NF) 2. It contains no transitive dependencies (where a non-key attribute is dependent on another non-key attribute Employee project table Project number - primary key Employee number - primary key Employee table Employee number - primary key Employee name Rate Category Project table Project number - primary key Project name These tables are all now in 3rd normal form, and ready to be implemented. Rate table Rate category - primary key Hourly rate

Daniel AdinugrohoDatabase Programming 18 OTHER NORMAL FORMS Boyce-Codd Normal Form (BCNF) R = relation schema X = a subset of the attributes of R A = attribute of R R is in BNF if for every Functional Dependencies, FD X -> A that holds over R, one of the following statements is true: ● A is an element of X, that is, it is a trivial FD, or ● X is a superkey BCNF, 4NF and 5NF are not discussed in Database Programming.

Daniel AdinugrohoDatabase Programming 19 EXERCISE Apply normal forms (1NF, 2NF, 3NF) and create the sample table for: Number - primary key Name Address Zip Code Town Hint: look for the answer in

Daniel AdinugrohoDatabase Programming 20 REFERENCES ● R. Ramakrishnan, J. Gehrke, Database Management System Chapter 2 and 15, McGraw Hill International Editions ● N. Matthew, R. Stones, Beginning Database with MySQL Chapter 11, Wrox ● Ian Gilfillan, Database Normalization, ● Mike Hillyer, An Introduction to Database Normalization, ● David Faour, Database Normalization,