(C) 2000, The University of Michigan 1 Database Application Design Handout #4 January 28, 2000.

Slides:



Advertisements
Similar presentations
Normalization: Kroenke Chapters 3 and 4. A relation is categorized by one of several normal forms. An aid to design helps characterize relations that.
Advertisements

Shantanu Narang.  Background  Why and What of Normalization  Quick Overview of Lower Normal Forms  Higher Order Normal Forms.
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
© 2002 by Prentice Hall 1 SI 654 Database Application Design Winter 2003 Dragomir R. Radev.
Foundations of Relational Implementation n Defining Relational Data n Relational Data Manipulation n Relational Algebra.
The Relational Model System Development Life Cycle Normalisation
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 8 Foundations of Relational Implementation.
Fundamentals, Design, and Implementation, 9/e Chapter 4 The Relational Model and Normalization.
Database Systems Chapter 6 ITM Relational Algebra The basic set of operations for the relational model is the relational algebra. –enable the specification.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 COS 346 Day 5.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 8 Foundations of Relational Implementation.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 5 The Relational Model and Normalization.
© 2002 by Prentice Hall 1 SI 654 Database Application Design Winter 2003 Dragomir R. Radev.
Relation Decomposition A, A, … A 12n Given a relation R with attributes Create two relations R1 and R2 with attributes B, B, … B 12m C, C, … C 12l Such.
Chapter 3 The Relational Model and Normalization
Daniel AdinugrohoDatabase Programming 1 DATABASE PROGRAMMING Lecture on 29 – 04 – 2005.
(C) 2000, The University of Michigan 1 Database Application Design Handout #3 January 21, 2000.
Relational Model & Relational Algebra. 2 Relational Model u Terminology of relational model. u How tables are used to represent data. u Connection between.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 6 NORMALIZATION FOR RELATIONAL DATABASES Instructor Ms. Arwa Binsaleh.
Lecture 12 Inst: Haya Sammaneh
Chapter 5 The Relational Model and Normalization David M. Kroenke Database Processing © 2000 Prentice Hall.
Fundamentals, Design, and Implementation, 9/e. Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/2 Copyright.
CMPE 226 Database Systems September 16 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
Chapter 13 Further Normalization II: Higher Normal Forms.
© 2002 by Prentice Hall 1 Database Design David M. Kroenke Database Concepts 1e Chapter 5 5.
Bordoloi Database Design: Normalization Dr. Bijoy Bordoloi.
RDBMS Concepts/ Session 3 / 1 of 22 Objectives  In this lesson, you will learn to:  Describe data redundancy  Describe the first, second, and third.
Chapter 4 The Relational Model and Normalization.
Chapter 13 Normalization Transparencies. 2 Last Class u Access Lab.
Database Management COP4540, SCS, FIU Relation Normalization (Chapter 14)
The Relational Model and Normalization R. Nakatsu.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall, Modified by Dr. Mathis 3-1 David M. Kroenke’s Chapter Three: The Relational.
The Relational Model and Normalization The Relational Model Normalization First Through Fifth Normal Forms Domain/Key Normal Form The Synthesis of Relations.
1 CS 3630 Database Design and Implementation. 2 Sets Foundation of relational database. Basic Operations Power set Mapping.
(C) 2000, The University of Michigan 1 Database Application Design Handout #10 March 17, 2000.
Functional Dependencies and Normalization for Relational Databases.
Normalization Ioan Despi 2 The basic objective of logical modeling: to develop a “good” description of the data, its relationships and its constraints.
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.
Feb 2001CSS/416:Module U1 Workshop 11 CSS/416 Data Design And Information Retrieval Workshop 1.
Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
CSc340 1b1 The Relational Model Chapter 2 Database Schema Keys Schema Diagrams Relational Query Languages Relational Operations.
1 Lecture 7: Normal Forms, Relational Algebra Monday, 10/15/2001.
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
Relational Algebra MBAD 613 R. Nakatsu. Relational Data Manipulation Language Query-by-Example; Query-by-Form Transform-Oriented Languages Relational.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
(C) 2000, The University of Michigan 1 Database Application Design Handout #5 February 4, 2000.
R. J. Daigle Normalization Concepts CIS 507 Database Programming.
Data Analysis Improving Database Design. Normalization The process of transforming a data model into a flexible, stable structure. Reduces anomalies Anomaly.
Relational Model & Normalization Relational terminology Anomalies and the need for normalization Normal forms Relation synthesis De-normalization.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
(C) 2000, The University of Michigan 1 Database Application Design Handout #2 January 14, 2000.
CSS/416 Data Design and Retrieval Workshop 3. CSS/416 Workshop 32 Database Management Systems Terminology Traditional MIS RDBMS Relational Algebra FileTableRelation.
Ch 7: Normalization-Part 1
Query Processing – Implementing Set Operations and Joins Chap. 19.
RELATIONAL TABLE NORMALIZATION. Key Concepts Guidelines for Primary Keys Deletion anomaly Update anomaly Insertion anomaly Functional dependency Transitive.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 5 The Relational Model and Normalization.
Logical Database Design and Relational Data Model Muhammad Nasir
5. The Relational Model and Normalization 5.1 Relational Model5.2 Normalization 5.3 1NF to 5NF 5.4 Domain/Key Normalization 5.5 Synthesis of Relation 5.6.
Relational Data Model, Review Relation Tuple Attribute Domains Candidate key, primary key Key attribute, non-key attribute.
1 CS490 Database Management Systems. 2 CS490 Database Normalization.
Normal Forms 1NF – A table that qualifies as a relation is in 1NF. (Back)(Back) 2NF – A relation is in 2NF if all of its nonkey attributes are dependent.
Ch 8: Foundations of Relational Implementation
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
The Relational Model and Normalization
Normalization.
Database Dr. Roueida Mohammed.
Chapter 4 The Relational Model and Normalization
Presentation transcript:

(C) 2000, The University of Michigan 1 Database Application Design Handout #4 January 28, 2000

(C) 2000, The University of Michigan 2 Course information Instructor: Dragomir R. Radev Office: 305A, West Hall Phone: (734) Office hours: Thursdays 3-4 and Fridays 1-2 Course page: Class meets on Fridays, 2:30 - 5:30 PM, 311 WH

(C) 2000, The University of Michigan 3 The relational model and normalization (cont’d)

(C) 2000, The University of Michigan 4 Third normal form (3NF) HOUSING (SID, Building, Fee) Key: SID FD : Building  Fee, SID  Building  Fee Transitive dependencies Is HOUSING in 1NF, in 2NF?

(C) 2000, The University of Michigan 5 Example

(C) 2000, The University of Michigan 6 Third Normal Form (Cont’d) Definition: 2NF with all transitive functional dependencies removed Example: STU-HOUSING (SID, Building) and BLDG-FEE (Building, Fee)

(C) 2000, The University of Michigan 7 Boyce-Codd Normal Form (BCNF) ADVISER (SID, Major, Fname) SID doesn’t determine Major SID doesn’t determine Fname either Candidate keys: (SID, Major) or (SID, Fname) Primary key Is ADVISER in 1NF? 2NF?

(C) 2000, The University of Michigan 8 Example

(C) 2000, The University of Michigan 9 BCNF (Cont’d) Are modification anomalies possible in ADVISER? BCNF: every determinant must be a candidate key ADVISER: Fname is not a candidate key Relations in BCNF have no anomalies as far as functional dependencies are concerned

(C) 2000, The University of Michigan 10 Fourth Normal Form (4NF) STUDENT (SID, Major, Activity) Key: (SID, Major, Activity) Multivalued dependencies: SID   Major SID   Activity Is the relationship between SID and Major a functional dependency?

(C) 2000, The University of Michigan 11 Update anomalies

(C) 2000, The University of Michigan 12 4NF (Cont’d) Eliminating multi-valued dependencies Definition of 4NF: BCNF with no multi- value dependencies

(C) 2000, The University of Michigan 13 Domain/Key Normal Form (DK/NF) Fagin (1981) showed that a relation in DK/NF is one with no modification anomalies and vice versa Definition: every constraint on a relation is a logical consequence of the definition of keys and domains

(C) 2000, The University of Michigan 14 Constraints in DK/NF Any rule governing static values of attributes that is precise enough so that we can determine its truth value Not included: “Salesperson salary in the current period can never be less than salary in the prior period”. Why?

(C) 2000, The University of Michigan 15 Keys and domains Keys Domains: physical description and logical description Definition: a relation is in DK/NF if enforcing key and domain restrictions causes all of the constraints to be met No formal algorithm

(C) 2000, The University of Michigan 16 Example 1 STUDENT (SID, GradeLevel, Building, Fee) Key: SID Constraints: Building  Fee SID mustn’t start with a 1 Solution: modify domain of SID

(C) 2000, The University of Michigan 17 Example 1 (cont’d) Need to make Building  Fee a logical consequence of a key However, building is NOT a key! –Remove building from STUDENT –Remove fee from STUDENT Every relation should have a single theme!

(C) 2000, The University of Michigan 18 DK definition Domain Definitions –SID in CDDD, where C is in {0,2-9} and D is in {0-9} –GradeLevel in {FR,SO,JR,SR,GR} –Building in CHAR(4) –Fee in DEC(4)

(C) 2000, The University of Michigan 19 DK definition (Cont’d) Relation and Key Definitions STUDENT (SID, GradeLevel, Building) Key: SID BLDG-FEE (Building, Fee) Key: Building

(C) 2000, The University of Michigan 20 Two more examples 2. PROFESSOR (FID, Fname, Class, SID, Sname) 3. STU-ADVISER (SID, Sname, FID, Fname, GradFacultyStatus)

(C) 2000, The University of Michigan 21 Foundations of relational implementation

(C) 2000, The University of Michigan 22 Defining relational data Relations (tables) Domains, attributes, constraints Relational structure (RS) Occurrence (RS + data) Relational schemas Keys: design and implementation semantics Logical and physical keys

(C) 2000, The University of Michigan 23 Implementing a relational database Defining the database structure using a data definition language (not always needed) Allocating media space Creating the database data

(C) 2000, The University of Michigan 24 Relational data manipulation Relational algebra Transform-oriented languages Query-by-example

(C) 2000, The University of Michigan 25 Interfaces to DBMS Forms-based data manipulation Query/Update language interface: –SELECT Name, Age FROM PATIENT WHERE Physician = ‘Levy’ Stored procedure interface –DO BILLING FOR BDATE = ‘9/15/1999’ Application program interface (API)

(C) 2000, The University of Michigan 26 Msql example $dbh = Msql->connect ($msql_hostname,$msql_databasename) $sth = $dbh->query (“select title, id from $table_name”) ($title,$id) = $sth->fetchrow();

(C) 2000, The University of Michigan 27 Relational algebra Relational operators: –UNION (for union compatible relations) –DIFFERENCE: STUDENT[Name]-JUNIOR[Name] –INTERSECTION –PRODUCT (Cartesian product) –PROJECTION –SELECTION –JOIN: STUDENT JOIN (SID = StudentNumber) ENROLLMENT

(C) 2000, The University of Michigan 28 Types of JOIN Equijoin Natural join Inner join Outer join (left and right)

(C) 2000, The University of Michigan 29 Expressing queries in relational algebra Examples (from book, Chapter 8)

(C) 2000, The University of Michigan 30 Readings for next time Kroenke –Chapter 8: Foundations of Relational Implementation –Chapter 9: Structured Query Language YRK (optional) –Chapter 6: SQL according to MySQL and mSQL