Chapter Three Objectives Identification of Keys Application of primary and foreign keys Converting a database design to Relational DB. What is a good DBMS.

Slides:



Advertisements
Similar presentations
Relational Terminology. Normalization A method where data items are grouped together to better accommodate business changes Provides a method for representing.
Advertisements

Chapter 10: Designing Databases
Functional Dependencies and Normalization for Relational Databases
Chapter Four Database Design (Relational) Objectives Summary Keys (Constraints) Relational DBMS Normal Forms.
NORMALIZATION FIRST NORMAL FORM (1NF): A relation R is in 1NF if all attributes have atomic value = one value for an attribute = no repeating groups =
Ch 10, Functional Dependencies and Normal forms
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Chapter 3. 2 Chapter 3 - Objectives Terminology of relational model. Terminology of relational model. How tables are used to represent data. How tables.
The Relational Database Model:
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
July 14, 2015ICS 424: recap1 Relational Database Design: Recap of ICS 324.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Module Title? DBMS E-R Model to Relational Model.
Relational Model Session 6 Course Name: Database System Year : 2012.
Functional Dependencies
Web-Enabled Decision Support Systems
Chapter One (Introduction) Objectives Introduction to Database Management Systems (DBMS) Relational Databases Model Restrictions of RD Database Life Cycle.
Q1: What is DBMS and explain its architecture. Q2: Explain Data Independence in detail. Q3: What is database user and explain the types of database user.
Concepts and Terminology Introduction to Database.
Relational databases and third normal form As always click on speaker notes under view when executing to get more information!
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
1 CSE 480: Database Systems Lecture 5: Relational Data Model.
NormalizationNormalization Chapter 4. Purpose of Normalization Normalization  A technique for producing a set of relations with desirable properties,
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities.
5 1 Chapter 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Lecture9:Functional Dependencies and Normalization for Relational Databases Prepared by L. Nouf Almujally Ref. Chapter Lecture9 1.
IMS 4212: Normalization 1 Dr. Lawrence West, Management Dept., University of Central Florida Normalization—Topics Functional Dependency.
1 Normalization, Roberts’s Rules and Introduction to Data Modeling CSCI 6442.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
Relational Data Model Ch. 7.1 – 7.3 John Ortiz Lecture 3Relational Data Model2 Why Study Relational Model?  Most widely used model.  Vendors: IBM,
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.
Relational Database. Database Management System (DBMS)
Unit 4 Object Relational Modeling. Key Concepts Object-Relational Modeling outcomes and process Relational data model Normalization Anomalies Functional.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
1 Functional Dependencies and Normalization Chapter 15.
Chapter Two ( Database Design) Objectives Learn how to design a DBMS Introduction to Data Models Entity-Relationship Data Models.
Normalization of Database Tables
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
Chapter Three ( Relational Data Model) Objectives Introduction to Relational Data Models. Advantages of Relational Data Models. Restriction of Relational.
Normalization MIS335 Database Systems. Why Normalization? Optimizing database structure Removing duplications Accelerating the instructions Data integrity!
Relational Model E.F. Codd at IBM 1970 Chapter 3 (ed. 7 – Chap. 5)
The Relational Model. 2 Relational Model Terminology u A relation is a table with columns and rows. –Only applies to logical structure of the database,
6-1 © Prentice Hall, 2007 Topic 6: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Howard Paul. Sequential Access Index Files and Data File Random Access.
Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer.
8-1 © Prentice Hall, 2007 Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
IMS 4212: Normalization 1 Dr. Lawrence West, Management Dept., University of Central Florida Normalization—Topics Functional Dependency.
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.
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.
Chapter Two Database Design (ER Model) Objectives: ER model Type of relationships Role in a relation Concept of Weak entities.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Lecture # 16 Chapter # 10 Normalization Database Systems.
Understanding Data Storage
Functional Dependency and Normalization
Revised: 2 April 2004 Fred Swartz
SEEM3430: Information Systems Analysis and Design
Payroll Management System
Relational Model and ER Model: in a Nutshell
Sampath Jayarathna Cal Poly Pomona
NORMALIZATION FIRST NORMAL FORM (1NF):
INSTRUCTOR: MRS T.G. ZHOU
Database Normalization.
Chapter 3 The Relational Model
Presentation transcript:

Chapter Three Objectives Identification of Keys Application of primary and foreign keys Converting a database design to Relational DB. What is a good DBMS

2 Keys: (Constraints) A set of attributes whose values uniquely identify each entity in an entity set.

3 Keys: (Constraints) Primary key: A key selected by the Database Administrator Characteristics of primary key: a.Uniqueness: At any given time, no two tuples can have the same value for a given primary key Example :

4 Keys: (Constraints) b.Minimally: None of the attributes in primary key can be discarded without distorting the uniqueness property Example:

5 Keys: (Constraints) Foreign key: An attribute(s) in an entity set (relation) which is the primary key of other entity set (relation) Example: Department(Name, Dept_Id, ….) Faculty(Name, Id, Dept_Id,…)

6 Practice: Identify the primary keys and foreign keys in your video store project.

7 Normal Forms (Guidelines for RD design) How do we know this design is good? If it is not a good design, What should we do? Modify our design ??.

8 Normal Forms (Guidelines for RD design) First Normal Form (1NF) Deals with the shape of the records A relation is in 1NF if the values of domain is atomic for each attribute.

9 First Normal Form: 1NF Example: R (A, B, C, …) R ( A B )R ( AB ) a1b1, b2=>a1b1 a1b2

10 First Normal Form: 1NF Example: Person (NameAgeChildren) Smith42John, Lori, Mark Person (NameAgeChildren) Smith42John Smith42Lori Smith42Mark

11 First Normal Form: 1NF Example: Student (NameBirthday) S1Feb 2,91 S2March 8,88 Student (Name, D_Birth, M_Birth, Y_Birth) Note: 2NF and 3NF Deal with the relationship between non-key and key

12 Second Normal Form: 2NF A relation is in 2NF if it is in 1NF and every attribute is Fully dependent on the entire key in this relation. Fact: 2NF is violated when a non-key is a fact about a subset of a key

13 Second Normal Form: 2NF Example: R(A,B,C,D) D partially depends on A,B C fully depends on A,B A&B are prime (part of key) If A is primary key. Is this in 2NF? If A&B is primary key. Is this in 2NF? A, B ---> C, D A ---> D

14 Second Normal Form: 2NF What should we do with a relation which is not in 2NF? Example: R(A,B,C,D) A, B ---> C, D A ---> D R1 (A,B,C) R2(A,D)

15 Second Normal Form: 2NF Example: R(PartWarehouseAddressQuantity P1W1Frostburg25 P2W1Frostburg30 P3W2Cumberland32 P4W4Frostburg25 P4W1 What is the primary key? Part, Warehouse ---> Quantity Warehouse ---> Address

16 Second Normal Form: 2NF Problems: 1. Repetition of information: Changing the address W! 2. Unable to present information: Warehouse with no part So … R1 (Warehouse, Address) R2 (Part, Warehouse, Quantity)

17 Second Normal Form: 2NF Example: R(Professor,Student,Course,Degree) P1S1C1Ph.D. P2S2C2M.S. P3S2C4M.S. P4S3C4Pg.D. Professor ---> Course Student ---> Degree Professor ---> Student Key? Not in 2NF R1(Student, Degree) R2(Professor, Course, Student)

18  A relation is 3NF if it is in 2NF and every non-key attribute non transitively depends on the Primary Key. Example: R(A,B,C,D) A, B --->D D ---> C Fact: 3NF is violated when a non-key is a fact about another non-key Third Normal Form (3NF): R1(A,B,D) R2(D,C)

19 Third Normal Form (3NF): Example: R(Employee, Dept, Location) Employee ---> Dept Dept ---> Location EmployeeDeptLocation E1D1Frostburg E2D2Frostburg E3D3Frostburg Problems? R1(Employee, Dept) R2(Dept, Location)

20 Third Normal Form (3NF): Example: R(A,B,C,D) A,B ---> C A,C ---> D So A,B is the Primary Key Not in 3NF R1(A,B,C) R2(A,C,D)

21 Practice: Check the relations in your video project for 1NF, 2NF and 3NF. If they are not in normal forms, redesign your database model.