The Relational Database Model – some relations you might want to avoid!!!

Slides:



Advertisements
Similar presentations
Entity Relationship (ER) Modeling
Advertisements

Entity Relationship (ER) Modeling
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Entity Relationship (ER) Modeling
The Relational Database Model
ITS232 Introduction To Database Management Systems
The Relational Database Model
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
Chapter 2 The Relational Database Model
Relational Model Stores data as tables –Each column contains values about the same attribute –Each column has a distinct name –Each row contains values.
The Relational Database Model
The Relational Database Model. 2 Objectives How relational database model takes a logical view of data Understand how the relational model’s basic components.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Database Architecture The Relational Database Model.
Chapter 14 & 15 Conceptual & Logical Database Design Methodology
The Relational Database Model
The Relational Database Model
3 The Relational Model MIS 304 Winter Class Objectives That the relational database model takes a logical view of data That the relational model’s.
The Relational Database Model
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Relational Model Session 6 Course Name: Database System Year : 2012.
Chapter 4 The Relational Model.
Lecture 3 The Relational DB Model. Learning Objectives That the relational database model takes a logical view of data That the relational model’s basic.
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Concepts and Terminology Introduction to Database.
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
The Relational Database Model
1 The Relational Database Model. 2 Learning Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Relational Database: RDB Concepts
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
1 Database & DBMS The data that goes into transaction processing systems (TPS), also goes to a database to be stored and processed later by decision support.
Database Design Sections 11 Database relationship, Integrity, keys, mapping conceptual model to logical/physical model Previous Section 12 – DDLesson11Fa12.ppt.
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.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
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.
Chapter 3 The Relational Database Model. Logical View of Data Relational Database – Designer focuses on logical representation rather than physical –
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Department of Mathematics Computer and Information Science1 CS 351: Database Systems Christopher I. G. Lanclos Chapter 3: The Relational Database Model.
3 1 Database Systems The Relational Database Model.
Logical Database Design and the Relational Model.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Chapter 3 The Relational Database Model. Database Systems, 10th Edition 2 * Relational model * View data logically rather than physically * Table * Structural.
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Mapping ER to Relational Model Each strong entity set becomes a table. Each weak entity set also becomes a table by adding primary key of owner entity.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 3 The Relational Database Model.
Week 2 Lecture The Relational Database Model Samuel ConnSamuel Conn, Faculty Suggestions for using the Lecture Slides.
Quiz Which of the following is not a mandatory characteristic of a relation? Rows are not ordered (Not required) Each row is a unique There is a.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. A database is a collection of information organized to provide efficient retrieval. The collected information.
The Relational Database Model
Tables and Their Characteristics
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 4 Relational Model Characteristics
CIS 207 The Relational Database Model
Lecture 2 The Relational Model
Chapter 3 The Relational Database Model
Chapter 3 The Relational Database Model.
Database Systems: Design, Implementation, and Management Ninth Edition
The Relational Database Model
DCT 2053 DATABASE CONCEPT Chapter 2.2 CONTINUE
Database Systems: Design, Implementation, and Management
Presentation transcript:

The Relational Database Model – some relations you might want to avoid!!!

2 Our HERO!!!

3 Logical vs. Physical Relational Database Designer focuses on logical representation rather than physical Use of table advantageous Structural and data independence Related records stored in independent tables Logical simplicity Allows for more effective design strategies

4 Logical View of Data Entities and Attributes Entity is a person, place, event, or thing about which data is collected Attributes are characteristics of the entity Tables Holds related entities or entity set Also called relations Comprised of rows and columns

5 Table Characteristics Two-dimensional structure with rows and columns Rows (tuples) represent single entity Columns represent attributes Row/column intersection represents single value Tables must have an attribute to uniquely identify each row Column values all have same data format Each column has range of values called attribute domain Order of the rows and columns is immaterial to the DBMS

6 Keys One or more attributes that determine other attributes Key attribute Composite key Full functional dependence Entity integrity Uniqueness No ‘null’ value in key

7 Keys SuperkeyUniquely identifies each entity Candidate keyMinimal superkey Primary keyCandidate key to uniquely identify all other attributes in a given row – used to uniquely identify each record Secondary keyUsed only for data retrieval Foreign keyValues must match primary key in another table

8 Example Tables Figure 2.1

9 Comparison Operators … A and B - Intersect A OR B –UNION: all of A (including yellow, gray and purple) all of B (including aqua, and purple and gray) C and B

10 Simple Relational Database Figure 2.2

11 Integrity Rules Entity integrity Ensures all entities are unique Each entity has unique key Referential integrity Foreign key must have null value or match primary key values Makes it impossible to delete row whose primary key has mandatory matching foreign key values in another table

12 Relationships within Relational Database Relationship classifications 1:1 1:M M:N E-R Model ERD Maps E-R model Chen Crow’s Feet

13 ERD Symbols Rectangles represent entities “1” side of relationship Number 1 in Chen Model Bar crossing line in Crow’s Feet Model “ Many” relationships –Letter “M” and “N” in Chen Model –Three pronged “Crow’s foot” in Crow’s Feet Model

14 Define Relationship Determine relationship using this terminology: (i.e. relationship between student and dorm rooms) 1 of A is related to X (1 or many) of B i.e. 1 student is assigned to 1 dorm room 1 of B is related to X (1 or many) of A i.e. 1 dorm room is assigned to many students The decision will be as follows: 1:1 1 of A is related to 1 of B 1 of B is related to 1 of A 1:M 1 of A is related to many of B 1 of B is related to 1 of A M:N 1 of A is related to many of B 1 of B is related to many of A

15 Relationship Resolution 1 to 1 (1:1) Assumed that the entity is just another attribute for that table. Add entity as another attribute to existing table

16 Relationship Resolution 1 to Many (1:M) The primary key of the one side is duplicated as the foreign key on the many side. RULE!!!! foreign key ALWAYS goes on Many side. Names of the primary key and the foreign key do not need to match - only the data type needs to be the same. Of course, the values of the data stored in the field must match as well or there can not be a join.

17 Relationship Resolution M:N 1.Resolve the M:N relationship into two 1:M relationships Create an associative entity (AKA composite entity or bridge entity) with primary keys (PK) of two entities as foreign keys (FK) Associative entity is many side of both 1:M relationships. FK ALWAYS goes on many side of relationship -> Associative entity ALWAYS many side of the relationship 2.If combination of 2 FKs unique, can use as PK of the associative entity. In this case, since PK be composed of 2 PKs, called composite key. 3.If combination of 2 FKs NOT unique, leave 2 FKs in associative entity. Create new PK for associative entity.

18 Comparison of Modeling Techniques 1:1 relationship Chen Infinity Crow’s Feet Car Steering Wheel 11 Car Steering Wheel 11 Car Steering Wheel 11

19 Comparison of Modeling Techniques 1:M relationship Chen Infinity Crow’s Feet Car Tire 1 ∞ Car Tire 1 Car Tire 1M

20 Example 1:M Relationship Figure 2.20

21 Comparison of Modeling Techniques M:N relationship (yes it seems it should be M:M but…) Chen Infinity Crow’s Feet Class Student ∞ Class Student Class Student M ∞ N

22 Example M:N Relationship Figure 2.24

23 Data Redundancy Revisited Foreign keys can reduce redundancy Some redundancy is desirable Called controlled redundancy Speed Information requirements

24 Points to location Makes retrieval of data faster Indexes Figure 2.31