Chapter 2. The Relational Model (cont.) IST2101. Review: Determinant vs. Candidate Key IST2102 DeterminantsCandidate Key (StudentID, CourseID) StudentID.

Slides:



Advertisements
Similar presentations
Copyright: ©2005 by Elsevier Inc. All rights reserved. 1 Author: Graeme C. Simsion and Graham C. Witt Chapter 3 The Entity-Relationship Approach.
Advertisements

The Relational Model DB Chapter 2 (and some from chapter 4, 5) J.G. Zheng June 27 th 2005.
The Relational Model J.G. Zheng May 15 th Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized.
Normalisation.
Normalization Process: Exercise 2: Step 1 IST2101 Step 1. Identify all the candidate keys of the relation. (Attorney, ClientNumber, MeetingDate)
Lab Exercise This Week PHP Basics See last Friday’s slides for requirements Make sure you show the final results to TA to get credit 1IST210.
Athabasca University Under Development for COMP 200 Gary Novokowsky
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Chapter 6 Methodology Logical Database Design for the Relational Model Transparencies © Pearson Education Limited 1995, 2005.
The Relational Model Chapter Two Functional Dependency.
Fundamentals, Design, and Implementation, 9/e Chapter 4 The Relational Model and Normalization.
Concepts of Database Management Sixth Edition
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 Model Chapter Two (Excerpts) DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
CSEN 5314 Quiz 3.
Chapter 2. The Relational Model (cont.) IST2101. Review: Functional Dependency A relationship between attributes: some attribute(s) determine the value.
Concepts of Database Management Seventh Edition
Entity PrimaryKey Attribute relationship Cardinality: zero to many Cardinality: one and only one Cardinality: one to many Explanation Entity Relationship.
Database Architecture The Relational Database Model.
Chapter 14 & 15 Conceptual & Logical Database Design Methodology
1 Relational model concepts Key constraints Referential integrity constraint Steen Jensen, autumn 2013.
Chapter 4 The Relational Model Pearson Education © 2014.
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Relational Model Session 6 Course Name: Database System Year : 2012.
Database Management System Lecture 6 The Relational Database Model – Keys, Integrity Rules.
10/9/20151 The Relational Data Model TCU Database Systems Last update: September 2004 Reference: Elmasri 4 th edition, chapter 5.
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
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.
Concepts of Database Management Sixth Edition Chapter 5 Database Design 1: Normalization.
Concepts of Database Management, Fifth Edition
Normalisation Rules and Practical Application Geoff Leese January 2010.
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.
MS Access: Creating Relational Databases Instructor: Vicki Weidler Assistant: Joaquin Obieta.
The Relational Model Chapter Two DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 3 rd Edition.
Normalization Process: Exercise 1: Step 1 IST2101 Step 1. Identify all the candidate keys of the relation. StudentNumber.
Database Design IST210 Class Lecture
Chapter 2. The Relational Model IST2101. Chapter 1 Review Potential problems with Lists – Deletion – Update – Insertion Avoid these problems using a relational.
Chapters 15 &16 Conceptual and Logical Database Design Methodology.
Concepts of Database Management Sixth Edition Chapter 6 Database Design 2: Design Method.
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.
Database Application Design and Data Integrity AIMS 3710 R. Nakatsu.
Chapter 2. The Relational Model (cont.)
CMU SCS Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications C. Faloutsos – A. Pavlo Lecture#16: Schema Refinement & Normalization.
The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Concepts 2440: 180 Database Concepts Instructor:
THE RELATIONAL MODEL II IST 210: Organization of Data IST210 1.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Concepts of Database Management Seventh Edition Chapter 5 Database Design 1: Normalization.
Assignment 1 Uploaded to course website Due next Tuesday, Sep 1, at 11:59pm.
THE RELATIONAL MODEL I IST 210: Organization of Data IST210 1.
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,
1 Class Agenda (04/06/2006 and 04/11/2006)  Discuss use of Visio for ERDs  Learn concepts and ERD notation for data generalization  Introduce concepts.
Databases Database Normalisation. Learning Objectives Design simple relational databases to the third normal form (3NF).
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
Chapter 4 The Relational Model Pearson Education © 2009.
MIDTERM REVIEW IST 210 Organization of Data IST210 1.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Methodology Logical Database Design for the Relational Model
Database, tables and normal forms
ISQS 6339, Business Intelligence Database vs. Data Warehouse
Databases and Information Management
Chapter 3 The Relational Model.
Databases and Information Management
Copyright © 2018, 2015, 20 Pearson Education, Inc. All Rights Reserved Database Concepts Eighth Edition Chapter # 2 The Relational Model.
Design tools and techniques for a relational database system
Chapter 3 The Relational Model
Presentation transcript:

Chapter 2. The Relational Model (cont.) IST2101

Review: Determinant vs. Candidate Key IST2102 DeterminantsCandidate Key (StudentID, CourseID) StudentID CourseID (StudentID, CourseID) In a relation, a candidate key must be a determinant In a relation, a determinant may not be a candidate key A relation is well-formed if and only if every determinant is a candidate key.

Normalization Process 1.Identify all the candidate keys of the relation. 2.Identify all the functional dependencies in the relation. 3.Examine the determinants of the functional dependencies. If any determinant is not a candidate key, the relation is not well formed. In this case: a.Place the columns of the functional dependency in a new relation of their own. b.Make the determinant of the functional dependency the primary key of the new relation. c.Leave a copy of the determinant as a foreign key in the original relation. d.Create a referential integrity constraint between the original relation and the new relation. 4.Repeat step 3 as many times as necessary until every determinant of every relation is a candidate key. IST2103

Normalization Process: Example 1: Step 1 IST2104 Step 1. Identify all the candidate keys of the relation. PrescriptionNumber

Normalization Process: Example 1: Step 2 IST2105 Step 2. Identify all the functional dependencies in the relation. Drug  Dosage? No Customer  (CustomerName, CustomerPhone)? Yes PrescriptionNumber  (Date, Drug, Dosage, CustomerName, CustomerPhone, Customer ) This is a trivial dependency by the definition of candidate key

Normalization Process: Example 1: Step 3 IST2106 Step 3. If any determinant is not a candidate key, the relation is not well formed. Determinant: PrescriptionNumber, Customer Candidate key: PrescriptionNumber Customer is NOT a candidate key, so the relation NOT well formed Then, we will normalize it (break it into multiple relations)

Normalization Process: Example 1: Step 3 IST2107 Step 3. Examine the determinants of the functional dependencies. If any determinant is not a candidate key, the relation is not well formed. In this case: a.Place the columns of the functional dependency in a new relation of their own. CUSTOMER (Customer , CustomerName, CustomerPhone) b.Make the determinant of the functional dependency the primary key of the new relation. CUSTOMER (Customer , CustomerName, CustomerPhone) c.Leave a copy of the determinant as a foreign key in the original relation. PRESCRIPTION(PrescriptionNumber, Date, Drug, Dosage, Customer ) d.Create a referential integrity constraint between the original relation and the new relation. Customer in PRESCRIPTION must exist in Customer in CUSTOMER

Normalization Process: Example 1: Step 4 IST2108 Step 4. Repeat step 3 as many times as necessary until every determinant of every relation is a candidate key. CUSTOMER (Customer , CustomerName, CustomerPhone) PRESCRIPTION(PrescriptionNumber, Date, Drug, Dosage, Customer ) Customer in PRESCRIPTION must exist in Customer in CUSTOMER Well-formed relational model design

Normalization Process: Exercise 1 IST2109 Step 1. Candidate keys: Step 2. Functional dependencies: Step 3. Determine if the relation is well-formed. If not, split the relation into multiple well-formed relations and specify all the primary keys, foreign keys and referential integrity constraints: Hint: If any determinant is not a candidate key, the relation is not well formed.

Normalization Process: Exercise 2 IST21010 Step 1. Candidate keys: Step 2. Functional dependencies: Step 3. Determine if the relation is well-formed. If not, split the relation into multiple well-formed relations and specify all the primary keys, foreign keys and referential integrity constraints: Hint: If any determinant is not a candidate key, the relation is not well formed.

Normalization Process: Exercise 3 IST21011 Step 1. Candidate keys Step 2. Functional dependencies GRADE(ClassName, Section, Term, Grade, StudentNumber, StudentName, Professor, ProfessorDepartment, Professor ) Step 3. Determine if the relation is well-formed. If not, split the relation into multiple well-formed relations and specify all the primary keys, foreign keys and referential integrity constraints: Hint: If any determinant is not a candidate key, the relation is not well formed.

Summary of Chapter 2 Learn the concept of the relational model: entities, relations, relationships Learn the meaning and importance of keys, foreign keys, and related terminology Learn the meaning of functional dependencies Learn to apply a process for normalizing relations IST21012

True/False Review Questions Given the functional dependency for the attributes of ENTITY1, X → (A, B, C), X is a candidate key for the relation ENTITY1 (A, B, C, X). Normalization is the process of removing all functional dependencies from a relation. In the normalization process, it is not necessary to identify all the functional dependencies in a relation. In the normalization process, if you find a candidate key that is not a primary key, then you have determined that the relation needs to be broken into two or more relations.