© 2002 by Prentice Hall 1 The Relational Model David M. Kroenke Database Concepts 1e Chapter 2 2.

Slides:



Advertisements
Similar presentations
The Relational Model DB Chapter 2 (and some from chapter 4, 5) J.G. Zheng June 27 th 2005.
Advertisements

The Relational Model J.G. Zheng May 15 th Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized.
Database Processing: Fundamentals, Design, and Implementation, 9/e by David M. KroenkeChapter 5/1 Copyright © 2004 Please……. No Food Or Drink in the class.
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.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 7 th Edition.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.
The Relational Model Chapter Two. 2 Chapter Objectives Learn the conceptual foundation of the relational model Learn the conceptual foundation of the.
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 David M. Kroenke’s Chapter Three: The Relational Model and Normalization.
The Relational Model Chapter Two Functional Dependency.
Fundamentals, Design, and Implementation, 9/e Chapter 4 The Relational Model and Normalization.
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 CIS 218. Entity A Person, Place, Thing or Transaction Something the user wants to track.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 David M. Kroenke Database Processing Chapter 3 Normalization.
Normalization I.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 COS 346 Day4.
The Relational Model Chapter Two (Excerpts) DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 5 th Edition.
Structured Query Language Chapter Three DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
Thomas Connolly and Carolyn Begg’s
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
N. J. Taylor Database Management Systems (DBMS) 1.
Chapter 3 The Relational Model and Normalization
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.
© 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.
Database Design Chapter Five DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
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.
R ELATIONAL D ATA M ODEL Joe Meehean 1. R ELATIONAL D ATA M ODEL Data stored as a set of relations really just tables Tables related to one another through.
Database Basics CPSC 4670/ Purpose of a Database The purpose of a database is to keep track of things Unlike a list or spreadsheet, a database.
Normalization. 2 Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification of various types of update anomalies.
© 2002 by Prentice Hall 1 Database Design David M. Kroenke Database Concepts 1e Chapter 5 5.
Chapter 4 The Relational Model and Normalization.
The Relational Model and Normalization R. Nakatsu.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
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 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.
Chapter 2. The Relational Model IST2101. Chapter 1 Review Potential problems with Lists – Deletion – Update – Insertion Avoid these problems using a relational.
CIS 210 Systems Analysis and Development Week 6 Part II Designing Databases,
The Relational Model J.G. Zheng Jan 2010 CIS 8040 Database Management Systems.
Chapter 2. The Relational Model (cont.)
THE RELATIONAL MODEL II IST 210: Organization of Data IST210 1.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/1 Copyright © 2004 Please……. No Food Or Drink in the class.
9/23/2012ISC329 Isabelle Bichindaritz1 Normalization.
+ Relational Model IST210 Class Lecture. + Premiere Products A new company that is going to sells random merchandise via sales representatives You have.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
THE RELATIONAL MODEL I IST 210: Organization of Data IST210 1.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 4 th Edition.
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,
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
DATA MODELING AND DATABASE DESIGN DATA MODELING AND DATABASE DESIGN Part 2.
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
Microsoft Access 2010 Chapter 11 Database Design.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
Logical Database Design and Relation Data Model Muhammad Nasir
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Three: The Relational Model and Normalization.
Chapter 4 The Relational Model Pearson Education © 2009.
David M. Kroenke and David J. Auer Database Processing: F undamentals, Design, and Implementation Chapter Three: The Relational Model and Normalization.
The Relational Model and Database Normalization
The Relational Model Chapter Two DATABASE CONCEPTS, 3rd Edition
ISQS 6339, Business Intelligence Database vs. Data Warehouse
Database Processing: David M. Kroenke’s Chapter Three:
David M. Kroenke and David J
Copyright © 2018, 2015, 20 Pearson Education, Inc. All Rights Reserved Database Concepts Eighth Edition Chapter # 2 The Relational Model.
Chapter 4 The Relational Model and Normalization
Presentation transcript:

© 2002 by Prentice Hall 1 The Relational Model David M. Kroenke Database Concepts 1e Chapter 2 2

© 2002 by Prentice Hall2 Chapter Objectives Learn the conceptual foundation of the relational model Understand how relations differ from nonrelational tables Learn basic relational terminology Learn the meaning and importance of keys, foreign keys, and related terminology

© 2002 by Prentice Hall3 Chapter Objectives (continued) Understand how foreign keys represent relationships Learn the purpose and use of surrogate keys Learn the meaning of functional dependencies Understand two basic relational design principles

© 2002 by Prentice Hall4 A Relation A relation is a two-dimensional table that has specific characteristics The table dimensions, like a matrix, consist of rows and columns

© 2002 by Prentice Hall5 Characteristics of a Relation Rows contain data about an entity Columns contain data about attributes of the entity Cells of the table hold a single value All entries in a column are of the same kind Each column has a unique name The order of the columns is unimportant The order of the rows is unimportant No two rows may be identical

© 2002 by Prentice Hall6 A Sample Relation EmployeeNumberFirstNameLastName 100MaryAbermany 700JerryCaldera 300AleaCopley 40MuruganJacksoni

© 2002 by Prentice Hall7 A Nonrelation Example EmployeeNumberPhoneLastName , Abermany Caldera Copley Jacksoni Cells of the table hold a single value

© 2002 by Prentice Hall8 EmployeeNumberPhoneLastName Abermany Caldera Copley Abermany Jacksoni No two rows may be identical A Nonrelation Example

© 2002 by Prentice Hall9 Terminology TableRowColumn File or DatafileRecordField RelationTupleAttribute Synonyms…

© 2002 by Prentice Hall10 A Key A key is one or more columns of a relation that is used to identify a row

© 2002 by Prentice Hall11 Uniqueness of Keys Unique KeyNonunique Key Data value is unique for each row. Consequently, the key will uniquely identify a row. Data value may be shared among several rows. Consequently, the key will identify a set of rows.

© 2002 by Prentice Hall12 A Composite Key A composite key is a key that contains two or more attributes For a key to be unique, often it must become a composite key

© 2002 by Prentice Hall13 Composite Key Example To identify a family member, you need to know a FamilyID, a FirstName, and a Suffix (e.g., Jr.) The composite key is: FamilyID, FirstName, Suffix One needs to know the value of all three columns to uniquely identify an individual

© 2002 by Prentice Hall14 A Candidate Key A candidate key is called “candidate” because it is a candidate to become the primary key A candidate key is a unique key

© 2002 by Prentice Hall15 A Primary Key A primary key is one chosen candidate key If you know the value of the primary key, you will be able to uniquely identify a single row

© 2002 by Prentice Hall16 Table Relationships A table may be related to other tables For example –An Employee works in a Department –A Manager controls a Project

© 2002 by Prentice Hall17 A Foreign Key To preserve relationships, you may need to create a foreign key A foreign key is a primary key from one table placed into another table The key is called a foreign key in the table that received the key

© 2002 by Prentice Hall18 Foreign Key Example Project ProjID ProjName MgrID Manager MgrID MgrName Foreign Key Primary Key

© 2002 by Prentice Hall19 Foreign Key Example Department DeptID DeptName Location Employee EmpID DeptID EmpName Foreign Key Primary Key

© 2002 by Prentice Hall20 Referential Integrity Referential integrity states that every value of a foreign key must match a value of the primary key For example –If EmpID = 4 has a DeptID = 7 (a foreign key). A Department with DeptID = 7 must exist and no other Department may have DeptID = 7

© 2002 by Prentice Hall21 Referential Integrity Another perspective… (The value of the Foreign Key EmployeeID) in EQUIPMENT must exist in (as a Primary Key value EmployeeID) in EMPLOYEE

© 2002 by Prentice Hall22 A Surrogate Key A Surrogate Key is a new key that takes the place of the Primary Key A Surrogate Key is typically used in place of a composite primary key It is clearer and easier to deal with one column, rather than a set of columns

© 2002 by Prentice Hall23 Surrogate Key Example Family Member Primary Key is FamilyID, FirstName, Suffix. It is easier to create a surrogate key of FamMemberID. This would be a unique key Referential Integrity… (FamilyID, FirstName, Suffix) in School must exist in (FamilyID, FirstName, Suffix) in FamilyMember Alternatively… (FamMemberID) in School must exist in (FamMemberID) in FamilyMember

© 2002 by Prentice Hall24 Functional Dependency The value of one column may determine the value of another column in the same table Illustration… –The price of one cookie can determine the price of a box of 12 cookies (CookiePrice, Qty)BillAmount

© 2002 by Prentice Hall25 Candidate/Primary Keys and Functional Dependency By definition… A candidate key of a relation will functionally determine all other columns in the row Likewise, by definition… A primary key of a relation will functionally determine all other columns in the row

© 2002 by Prentice Hall26 Primary Key and Functional Dependency Example (EmployeeID) (EmpLastName, EmpAddr, EmpPhone) (ProjectID)(ProjectName, StartDate)

© 2002 by Prentice Hall27 Normalization Normalization is a process of analyzing a relation to ensure it is well formed More specifically, if a relation is normalized, rows can be added, removed, or updated without creating exceptions

© 2002 by Prentice Hall28 Stages of Normalization Relations are tested for various conditions to ensure normalization At the conclusion of specific sets of tests, a relation is said to be in a “Normal Form” There are several Normal Forms –First Normal Form, Second Normal Form, Third Normal Form, Boyce-Codd Normal Form, Fourth Normal Form, Fifth Normal Form, and Domain/Key Normal Form

© 2002 by Prentice Hall29 Un-Normalized Example (StudentID) (StudentName, DormName, DormCost) (DormName)(DormCost) Then DormCost should be placed into its own relation However, if… (StudentID) (StudentName, DormName) Resulting in… (DormName)(DormCost)

© 2002 by Prentice Hall30 Un-Normalized Example (AttorneyID, ClientID) (ClientName, MeetingDate, Duration) (ClientID)(ClientName) Then ClientName should be placed into its own relation However, if… Resulting in… (ClientID)(ClientName) (AttorneyID, ClientID) (MeetingDate, Duration)

© 2002 by Prentice Hall31 The Null Value A Null value means that no data was entered This is different from a zero, space character, or tab character

© 2002 by Prentice Hall32 The Problem of Null Values A Null is often ambiguous. It could mean… –The column value is not appropriate for the specific row –The column value is not decided –The column value is unknown Each may have entirely different implications

© 2002 by Prentice Hall 33 The Relational Model David M. Kroenke Database Concepts 1e Chapter 2 2