The Relational Database Model

Slides:



Advertisements
Similar presentations
Relational Database Operators
Advertisements

The Relational Model and Relational Algebra Nothing is so practical as a good theory Kurt Lewin, 1945.
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
The Relational Database Model – some relations you might want to avoid!!!
The Relational Database Model
ITS232 Introduction To Database Management Systems
The Relational Database Model
Chapter 2 The Relational Database Model
Relational Algebra Relational Calculus. Relational Algebra Operators Relational algebra defines the theoretical way of manipulating table contents using.
The Relational Database Model
LIS 557 Database Design and Management William Voon Michael Cole Spring '04.
Chapter 3 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.
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.
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
Databases Illuminated
Chapter 3 Section 3.4 Relational Database Operators
ITEC 3220M Using and Designing Database Systems Instructor: Prof. Z.Yang Course Website: 3220m.htm
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
G057 - Lecture 02 Introduction To Database System Concepts Mr C Johnston ICT Teacher
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T5 DESIGNING DATABASE APPLICATIONS.
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.
M Taimoor Khan Course Objectives 1) Basic Concepts 2) Tools 3) Database architecture and design 4) Flow of data (DFDs)
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Module Coordinator Tan Szu Tak School of Information and Communication Technology, Politeknik Brunei Semester
CS424 Relational Data Manipulation Relational Data Manipulation Relational tables are sets. Relational tables are sets. The rows of the tables can be considered.
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 –
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.
3 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Relational Algebra Operators (continued) Difference –Yields all.
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 2 : RELATIONAL DATA MODEL Prepared by : nbs.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
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.
The Relational Database Model
DESIGNING DATABASE APPLICATIONS
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 4 Relational Model Characteristics
CIS 207 The Relational Database Model
Lecture 2 The Relational Model
Theory behind the relational engine
Theory behind the relational engine
Databases and Information Management
The Relational Database Model
Chapter 3 The Relational Database Model
Chapter 3 The Relational Database Model.
Database Systems: Design, Implementation, and Management Ninth Edition
Databases and Information Management
DATABASE SYSTEM.
The Relational Database Model
Chapter # 3 The Relational Database Model.
DCT 2053 DATABASE CONCEPT Chapter 2.2 CONTINUE
Database Systems: Design, Implementation, and Management
Relational Database Operators
Presentation transcript:

The Relational Database Model

A Logical View of Data Relational database model’s structural and data independence enables us to view data logically rather than physically. The logical view allows a simpler file concept of data storage. The use of logically independent tables is easier to understand. Logical simplicity yields simpler and more effective database design methodologies.

A Logical View of Data Entities and Attributes An entity is a person, place, event, or thing for which we intend to collect data. University -- Students, Faculty Members, Courses Airlines -- Pilots, Aircraft, Routes, Suppliers Each entity has certain characteristics known as attributes. Student -- Student Number, Name, GPA, Date of Enrollment, Data of Birth, Home Address, Phone Number, Major Aircraft -- Aircraft Number, Date of Last Maintenance, Total Hours Flown, Hours Flown since Last Maintenance

A Logical View of Data Entities and Attributes A grouping of related entities becomes an entity set. The STUDENT entity set contains all student entities. The FACULTY entity set contains all faculty entities. The AIRCRAFT entity set contains all aircraft entities.

A Logical View of Data Tables and Their Characteristics A table contains a group of related entities -- i.e. an entity set. The terms entity set and table are often used interchangeably. A table is also called a relation.

Summary of the Characteristics of a Relational Table

A Listing of the STUDENT Table Attribute Values Figure 2.1

Keys Controlled redundancy (shared common attributes) makes the relational database work. The primary key of one table appears again as the link (foreign key) in another table. If the foreign key contains either matching values or nulls, the table(s) that make use of such a foreign key are said to exhibit referential integrity.

Figure 2.2 An Example of a Simple Relational Database

Relational Database Keys Table 2.3

Integrity Rules Revisited Table 2.4

Figure 2.4 An Illustration of Integrity Rules

Relational Database Operators The degree of relational completeness can be defined by the extent to which relational algebra is supported. Relational algebra defines the theoretical way of manipulating table contents using the eight relational functions: SELECT, PROJECT, JOIN, INTERSECT, UNION, DIFFERENCE, PRODUCT, and DIVIDE.

Relational Database Operators UNION combines all rows from two tables. The two tables must be union compatible. Figure 2.5 UNION

Relational Database Operators INTERSECT produces a listing that contains only the rows that appear in both tables. The two tables must be union compatible. Figure 2.6 INTERSECT

Relational Database Operators DIFFERENCE yields all rows in one table that are not found in the other table; i.e., it subtracts one table from the other. The tables must be union compatible. Figure 2.7 DIFFERENCE

Relational Database Operators PRODUCT produces a list of all possible pairs of rows from two tables. Figure 2.8 PRODUCT

Relational Database Operators SELECT yields values for all attributes found in a table. It yields a horizontal subset of a table.

Relational Database Operators PROJECT produces a list of all values for selected attributes. It yields a vertical subset of a table.

Relational Database Operators JOIN allows us to combine information from two or more tables. JOIN is the real power behind the relational database, allowing the use of independent tables linked by common attributes.

Relational Database Operators Natural JOIN links tables by selecting only the rows with common values in their common attribute(s). It is the result of a three-stage process: A PRODUCT of the tables is created. (Figure 2.12) A SELECT is performed on the output of the first step to yield only the rows for which the common attribute values match. (Figure 2.13) A PROJECT is performed to yield a single copy of each attribute, thereby eliminating the duplicate column. (Figure 2.14)

Natural Join, Step 1: PRODUCT Figure 2.12

Figure 2.13 Natural Join, Step 2: SELECT Figure 2.14 Natural Join, Step 3: PROJECT

Relational Database Operators EquiJOIN links tables based on an equality condition that compares specified columns of each table. The outcome of the EquiJOIN does not eliminate duplicate columns and the condition or criteria to join the tables must be explicitly defined. Theta JOIN is an equiJOIN that compares specified columns of each table using a comparison operator other than the equality comparison operator. In an Outer JOIN, the unmatched pairs would be retained and the values for the unmatched other tables would be left blank or null.

Outer JOIN Figure 2.15

Relational Database Operators DIVIDE requires the use of one single-column table and one two-column table. Figure 2.16 DIVIDE

A Sample Data Dictionary Table 2.6

Relationships within the Relational Database E-R Diagram (ERD) Rectangles are used to represent entities. Entity names are nouns and capitalized. Diamonds are used to represent the relationship(s) between the entities. The number 1 is used to represent the “1” side of the relationship. The letter M is used to represent the “many” sides of the relationship.

The Relationship Between Painter and Painting Figure 2.17

Figure 2.18 An Alternate Way to Present the Relationship Between Painter and Painting Figure 2.18

A 1:M Relationship: The CH2_MUSEUM Database Figure 2.19

The 1:M Relationship Between Course and Class Figure 2.20

The M:N Relationship Between Student and Class Figure 2.22

Sample Student Enrollment Data Table 2.7

A Many-to-Many Relationship Between Student and Class Figure 2.23

Changing the M:N Relationship to Two 1:M Relationships Figure 2.25

The Expanded Entity Relationship Model Figure 2.26

Figure 2.27 The Relational Schema for the Entity Relationship Diagram in Figure 2.26 Figure 2.27

Data Redundancy Revisited Proper use of foreign keys is crucial to exercising data redundancy control. Database designers must reconcile three often contradictory requirements: design elegance, processing speed, and information requirements. (Chapter 4) Proper data warehousing design even requires carefully defined and controlled data redundancies, to function properly. (Chapter 13)

Figure 2.28 A Small Invoicing System

Figure 2.29 The Relational Schema for the Invoicing System in Figure 2.28 The redundancy is crucial to the system’s success. Copying the product price from the PRODUCT table to the LINE table means that it is possible to maintain the historical accuracy of the transactions.