Chapter Three ( Relational Data Model) Objectives Introduction to Relational Data Models. Advantages of Relational Data Models. Restriction of Relational.

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 Three Objectives Identification of Keys Application of primary and foreign keys Converting a database design to Relational DB. What is a good DBMS.
Chapter Four Database Design (Relational) Objectives Summary Keys (Constraints) Relational DBMS Normal Forms.
Normalisation Ensuring data integrity in database design 1.
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Normalization of Database Tables
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
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:
Normalization of Database Tables
Normalization of Database Tables
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
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.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 5 Normalization of Database Tables.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
NORMALIZATION N. HARIKA (CSC).
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
The Relational Database Model
Chapter 5 Normalization of Database Tables
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Chapter 4 The Relational Model Pearson Education © 2014.
Chapter 3 The Relational Model Transparencies Last Updated: Pebruari 2011 By M. Arief
Week 6 Lecture Normalization
Chapter One (Introduction) Objectives Introduction to Database Management Systems (DBMS) Relational Databases Model Restrictions of RD Database Life Cycle.
Concepts and Terminology Introduction to Database.
Chapter 3 The Relational Model. 2 Chapter 3 - Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between.
Database Systems: Design, Implementation, and Management Tenth Edition
5 1 Chapter 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables.
King Saud University College of Computer & Information Sciences Computer Science Department CS 380 Introduction to Database Systems Functional Dependencies.
1 DATABASE SYSTEMS DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT Chapter 7 Normalisation.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
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.
1 The Relational Database Model. 2 Learning Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical.
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
Relational Data Model Ch. 7.1 – 7.3 John Ortiz Lecture 3Relational Data Model2 Why Study Relational Model?  Most widely used model.  Vendors: IBM,
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
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.
Database Systems, 9th Edition 1.  In this chapter, students will learn: That the relational database model offers a logical view of data About the relational.
Database Principles: Fundamentals of Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables Carlos Coronel, Steven.
Lecture 8: Database Concepts May 4, Outline From last lecture: creating views Normalization.
Normalization of Database Tables
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 3 The Relational Database Model.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 3 The Relational Database Model.
Normalization MIS335 Database Systems. Why Normalization? Optimizing database structure Removing duplications Accelerating the instructions Data integrity!
Normalization Example. Database Systems, 8 th Edition 2 Database Tables and Normalization Normalization –Process for evaluating and correcting table structures.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
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,
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
6-1 © Prentice Hall, 2007 Topic 6: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
8-1 © Prentice Hall, 2007 Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
Chapter 4 The Relational Model Pearson Education © 2009.
5 1 Chapter 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
What Is Normalization  In relational database design, the process of organizing data to minimize redundancy  Usually involves dividing a database into.
Normalizing Database Designs. 2 Objectives In this chapter, students will learn: –What normalization is and what role it plays in the database design.
Understanding Data Storage
Chapter 4 The Relational Model Pearson Education © 2009.
Relational Database Model
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Presentation transcript:

Chapter Three ( Relational Data Model) Objectives Introduction to Relational Data Models. Advantages of Relational Data Models. Restriction of Relational Data Model. Keys. What are a good BD Design?

2 Relational Data Model: Developed by Codd in Conceptually simple. Based on mathematical set theory.

3 Relational Data Model: Most important advantage of the RDBMS is its ability to hide the complexities of the relational model from the user.

Relational Database Models: Data are represented as a set of tables.

5 Structure A set of tables ( Relations). Each relation has a unique name. Each relation has a set of attributes. Each relation has a set of tuples.

6 Restriction on Relational DBMS No two tuples are the same. No two attributes are the same. Order of tuples are immaterial. Order of attributes are immaterial. Value of attributes must be atomic.

7 Relational Database Example: Students Courses Faculty

Attributes of a Relation: Students (Name, ID, Major, Minor,….) Courses ( C_num, Dept, Cr, Description) Faculty (Name, ID, SSN, …..) 8

Tuples: Students (Name, ID, Major, Minor,….) _________________________________ John Smith1111, ITEC, VART Mary Smith2222, COSC, ITEC Lorry Joys4444, ACCT, COSC Courses (C_num, Dept, Cr, Description) _______________________________________ 345 ITEC 3 Databases I 445 ITEC 3 Databases II 9

10 Keys: (Constraints) A set of attributes whose values uniquely identify each entity. Examples: Students (Name, ID, Major, Minor,….) Courses (C_num, Dept, Cr, Description) Faculty (Name, ID, SSN, …..)

11 Keys: (Constraints) Primary key: 1- Uniqueness: At any given time, no two tuples can have the same value for a given primary key. 2-Minimally: None of the attributes in primary key can be discarded without distorting the uniqueness property 3-Selection: A key selected by the Database Administrator.

Primary key: Key’s role is based on determination If you know the value of attribute A, you can look up (determine) the value of attribute B. ID  GPA 12

13 Keys Composite key Composed of more than one attribute. Key attribute Any attribute that is part of a key. Superkey Any combination of attributes that uniquely identifies each row. Candidate key

14 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,…)

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

Normalization: Process for evaluating and correcting table structures to minimize data redundancies Reduces data anomalies Works through a series of stages called normal forms: First normal form (1NF) Second normal form (2NF) Third normal form (3NF) 16

Why Normalize Tables: Structure of data does not handle data very well The table structure appears to work; Report generated with ease Unfortunately, report may yield different results depending on what data anomaly has occurred 17

Each table represents a single subject No data item will be unnecessarily stored in more than one table All attributes in a table are dependent on the primary key 18

19 Normal Forms (Guidelines for RD design) A relation is in 1NF if the values of domain is atomic for each attribute.

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

21 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

First Normal Form: Repeating group Derives its name from the fact that a group of multiple entries of same type can exist for any single key attribute occurrence Relational table must not contain repeating groups Normalizing table structure will reduce data redundancies 22

23 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.

24 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

25 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)

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

27 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)

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

29  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)

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

31 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)

32 Null Values: No data entry Not permitted in primary key It is represent as: An unknown attribute value A known, but missing, attribute value A “not applicable” condition

33 Controlled redundancy: Makes the relational database work Tables within the database share common attributes that enable the tables to be linked together Multiple occurrences of values in a table are not redundant when they are required to make the relationship work Redundancy exists only when there is unnecessary duplication of attribute values