The Relational Model J.G. Zheng Jan 2010 CIS 8040 Database Management Systems.

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.
The Relational Model Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
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.
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.
Chapter 14 Getting to First Base: Introduction to Database Concepts.
The Relational Database Model:
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 COS 346 Day 8.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 COS 346 Day 7.
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.
Thomas Connolly and Carolyn Begg’s
Database Architecture The Relational Database Model.
The Relational Database Model
Chapter 3 The Relational Model and Normalization
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.
Chapter 4 The Relational Model.
RAJIKA TANDON DATABASES CSE 781 – Database Management Systems Instructor: Dr. A. Goel.
Concepts of Database Management Seventh Edition Chapter 4 Keys and Relationship.
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.
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.
Chapter 2. The Relational Model IST2101. Chapter 1 Review Potential problems with Lists – Deletion – Update – Insertion Avoid these problems using a relational.
Slide Chapter 5 The Relational Data Model and Relational Database Constraints.
Databases MIS 21. Some database terminology  Database: integrated collection of data  Database Management System (DBMS): environment that provides mechanisms.
System Design System Design - Mr. Ahmad Al-Ghoul System Analysis and Design.
The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Concepts 2440: 180 Database Concepts Instructor:
Relational Theory and Design
12/2/2015CPSC , CPSC , Lecture 41 Relational Model.
+ Relational Model IST210 Class Lecture. + Premiere Products A new company that is going to sells random merchandise via sales representatives You have.
The relational model A data model (in general) : Integrated collection of concepts for describing data (data requirements). Relational model was introduced.
THE RELATIONAL MODEL I IST 210: Organization of Data IST210 1.
© 2002 by Prentice Hall 1 The Relational Model David M. Kroenke Database Concepts 1e Chapter 2 2.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 4 th Edition.
* Database is a group of related objects * Objects can be Tables, Forms, Queries or Reports * All data reside in Tables * A Row in a Table is a record.
1 SY306: Web and Databases for Cyber Operations Slide Set: 11 Databases - Relational Model.
Relational Database Model & Database Development Process IST359 M005 Yang Wang 342 Hinds
Howard Paul. Sequential Access Index Files and Data File Random Access.
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
DATA MODELING AND DATABASE DESIGN DATA MODELING AND DATABASE DESIGN Part 2.
Concepts of Database Management Seventh Edition Chapter 4 Keys and Relationship.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
Normalization ACSC 425 Database Management Systems.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
The Relational Model and Database Normalization
The Relational Model Chapter Two DATABASE CONCEPTS, 3rd Edition
Translation of ER-diagram into Relational Schema
ERD’s REVIEW DBS201.
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
The Relational Model Transparencies
Chapter 4 The Relational Model Pearson Education © 2009.
Getting to First Base: Introduction to Database Concepts
Copyright © 2018, 2015, 20 Pearson Education, Inc. All Rights Reserved Database Concepts Eighth Edition Chapter # 2 The Relational Model.
Getting to First Base: Introduction to Database Concepts
Chapter 4 The Relational Model Pearson Education © 2009.
INSTRUCTOR: MRS T.G. ZHOU
Getting to First Base: Introduction to Database Concepts
Presentation transcript:

The Relational Model J.G. Zheng Jan 2010 CIS 8040 Database Management Systems

Overview What is the relational model? What are the most important practical elements of relational model?

Introduction Edgar F. Codd (IBM), 1970 One sentence to summarize relational database model (extremely brief): Data are organized in relations (tables), which are linked (relationship) by keys

Introduction What’s in a database? Tables Relationships Metadata How are data organized in a database? Data are organized in tables, which are linked (relationship) by keys

Relation A relation is a two-dimensional table that has specific characteristics: The table consist of rows and columns Rows contain data about entity instances All values in a row describes the same entity instance Columns contain data about attributes of the entity All values in a column are of the same kind

Relation (continued) Relation’s specific characteristics go on: Each row is distinct A Cell of the table hold a single value Each column has a unique name The order of the rows is unimportant The order of the columns is unimportant

Relation Example

Non-Relation Examples (1)

Non-Relation Examples (2) Emp_NameEmp_AgeEmp_Phone Emp_ Jordan Hail Jack Tom Jackson Liz MarstenThirty Jordan Hail

Are they the same?

Terminology Contrast Database industry TableRowColumn File processing FileRecordField Academic RelationTupleAttribute

Keys A key is one or more columns of a relation that is used to identify a record Unique keys  Candidate key  Primary key  Surrogate key Foreign key Composite key

Candidate Key/Primary Key Candidate key The minimum set of column(s) that uniquely identifies a single record (row) Primary key Is one of the candidate keys chosen to be the identifying key There is only one primary key for a relation/table

Primary Key Primary key is a column/attribute that is used to uniquely identify a record The value of this key column uniquely identifies a single record (row) There is only one primary key for a table Can the following attribute uniquely indentify a record? Last Name Student Number Social Security Number ISBN

Artificial Primary Key/Surrogate Key Very often it is difficult to have a natural attribute to identify one thing A column is created arbitrarily and assign each record a unique number/id Product Number, Product Id Movie Id Actor Id

Relationship and Foreign Key Relationship defines how tables (relations) are linked Two tables are linked by a pair of keys The primary key of one table The foreign key in the linked table These two keys are of the same kind (may be of different name)

Relationship Example Primary Key (PK) Foreign Key (FK)

Foreign Key Example Primary Key and Foreign Key are of the same type (string, number, etc.) and length, but they do not necessarily have the same name. Department DeptID DeptName Location Employee EmpID EmpName Department Foreign Key Primary Key

Composite Key Composite key: A key that contains two or more attributes (columns) Example: “FirstName” + “LastName” “FirstName” + “LastName” + “BirthDate” “FirstName” + “LastName” + “BirthDate” + “BirthCity” … All keys can be composite keys True or False: The combination of all columns of a relation is a candidate key

Referential Integrity Every value of a foreign key must match a value of the primary key or be “null” For example (slide #17) In “Customer” table, “RepNum” is a foreign key (linked to the “Rep” table where “RepNum” is the primary key). Then every value of “RepNum” in the “Customer” table must exist in the “Rep” table

“Null” Value “Null” means value is inapplicable: e.g., Fax_Number = Null value is unknown: e.g., Stud_Grade = Null “Null” does not mean zero blank space No primary key (or part of a composite primary key) can be null

22 Common Data Types Numeric INTEGER, SMALLINT DECIMAL(i,j), NUMBER(i,j) Character/String CHAR(n), VARCHAR(n), Text Date DATE, DATETIME Data types reference Access 2007: SQL Server 2005:

Summary Key concepts Relation Keys  Primary key, candidate key, surrogate key  Composite key  Foreign key Referential integrity Null