Chapter 2: Relational Model

Similar documents
Database System Concepts, 5 th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

Chapter 2: Relational Model

Chapter 2: Intro to Relational Model

CSE 132A Database Systems Principles

A database can be modeled as: + a collection of entities, + a set of relationships among entities.

Database System Concepts

Relational Model. Nisa ul Hafidhoh

CS34800 Information Systems. The Relational Model Prof. Walid Aref 29 August, 2016

Chapter 3: Relational Model

CS425 Fall 2016 Boris Glavic Chapter 2: Intro to Relational Model

Chapter 2: Intro to Relational Model

DATABASE TECHNOLOGY - 1DL124

DATABASE TECHNOLOGY. Spring An introduction to database systems

Chapter 7: Relational Database Design

DATABASE DESIGN I - 1DL300

Chapter 6: Entity-Relationship Model

A database consists of several tables (relations) AccountNum

Relational Model. Prepared by: Ms. Pankti Dharwa ( Asst. Prof, SVBIT)

Chapter 2 Introduction to Relational Models

Chapter 6: Relational Database Design

Lecture Notes for 3 rd August Lecture topic : Introduction to Relational Model. Rishi Barua Shubham Tripathi

Lecture 14 of 42. E-R Diagrams, UML Notes: PS3 Notes, E-R Design. Thursday, 15 Feb 2007

customer = (customer_id, _ customer_name, customer_street,

Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the Bank Database Reduction to

Chapter 1: Introduction

Unit 3 : Relational Database Design

Other Relational Query Languages

Chapter 6: Entity-Relationship Model

CSCI1270 Introduction to Database Systems

Upon completion of this Unit, students will be introduced to the following

DBMS: AN INTERACTIVE TUTORIAL

Introduction to Relational Databases. Introduction to Relational Databases cont: Introduction to Relational Databases cont: Relational Data structure

Chapter 5: Other Relational Languages

Chapter 6: Entity-Relationship Model

Example: specific person, company, event, plant

Chapter 8: Relational Database Design

Chapter 19: Distributed Databases

COURSE OVERVIEW THE RELATIONAL MODEL. CS121: Relational Databases Fall 2017 Lecture 1

Chapter 3: SQL. Chapter 3: SQL

COURSE OVERVIEW THE RELATIONAL MODEL. CS121: Introduction to Relational Database Systems Fall 2016 Lecture 1

QQ Group

Relational Algebra. Relational Algebra. 7/4/2017 Md. Golam Moazzam, Dept. of CSE, JU

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Relational Databases Fall 2017 Lecture 7

CSIT5300: Advanced Database Systems

Chapter 3: SQL. Database System Concepts, 5th Ed. Silberschatz, Korth and Sudarshan See for conditions on re-use

Chapter 6: Formal Relational Query Languages

Chapter 4. The Relational Model

D.Hemavathi & R.Venkatalakshmi, Assistant Professor, SRM University, Kattankulathur

Query processing and optimization

CMSC 424 Database design Lecture 4: Relational Model ER to Relational model. Book: Chap. 2 and 6. Mihai Pop

CS275 Intro to Databases

Textbook: Chapter 6! CS425 Fall 2013 Boris Glavic! Chapter 3: Formal Relational Query. Relational Algebra! Select Operation Example! Select Operation!

UNIT 2 RELATIONAL MODEL

CS121 MIDTERM REVIEW. CS121: Relational Databases Fall 2017 Lecture 13

Database Management Systems LECTURE NOTES 2

Comp 5311 Database Management Systems. 2. Relational Model and Algebra

DATABASE TECHNOLOGY - 1MB025 (also 1DL029, 1DL300+1DL400)

Chapter 1: Introduction

CMSC 424 Database design Lecture 18 Query optimization. Mihai Pop

U1. Data Base Management System (DBMS) Unit -1. MCA 203, Data Base Management System

1. (a) Explain the Transaction management in a database. (b) Discuss the Query Processor of Database system structure. [8+8]

Database Technology Introduction. Heiko Paulheim

CSCC43H: Introduction to Databases. Lecture 3

Database Systems. Lecture2:E-R model. Juan Huo( 霍娟 )

Chapter 14: Query Optimization

Silberschatz, Korth and Sudarshan See for conditions on re-use

Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

Databases. Jörg Endrullis. VU University Amsterdam

Chapter 1: Introduction. Chapter 1: Introduction

In mathematical terms, the relation itself can be expressed simply in terms of the attributes it contains:

CS352 - DATABASE SYSTEMS. To give you experience with developing a database to model a real domain

Other Query Languages II. Winter Lecture 12

THE RELATIONAL DATA MODEL CHAPTER 3 (6/E) CHAPTER 5 (5/E)

Relational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity

Midterm Review. Winter Lecture 13

The Basic (Flat) Relational Model. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

7042 Datenbanken. Prof. O. Nierstrasz. Wintersemester 1997/98

Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

Entity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables

CAS CS 460/660 Introduction to Database Systems. Fall

CSCI1270 Introduction to Database Systems

Domain Constraints Referential Integrity Assertions Triggers. Authorization Authorization in SQL

Database Management System 9

II. Structured Query Language (SQL)

Databases Tutorial. March,15,2012 Jing Chen Mcmaster University

Chapter 5. Relational Model Concepts 5/2/2008. Chapter Outline. Relational Database Constraints

Chapter 1: Introduction

Chapter 5. Relational Model Concepts 9/4/2012. Chapter Outline. The Relational Data Model and Relational Database Constraints

Supplier-Parts-DB SNUM SNAME STATUS CITY S1 Smith 20 London S2 Jones 10 Paris S3 Blake 30 Paris S4 Clark 20 London S5 Adams 30 Athens

Chapter 5. The Relational Data Model and Relational Database Constraints. Slide 5-١. Copyright 2007 Ramez Elmasri and Shamkant B.

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 5-1

Database Management Systems (CPTR 312)

Chapter 6: Entity-Relationship Model

The Relational Data Model and Relational Database Constraints

CS352 - DATABASE SYSTEMS

The Relational Model

Relational Model History. COSC 304 Introduction to Database Systems. Relational Model and Algebra. Relational Model Definitions.

Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

UNIT- II (Relational Data Model & Introduction to SQL)

Let s briefly review important EER inheritance concepts

Transcription:

Chapter 2: Relational Model Database System Concepts, 5 th Ed. See www.db-book.com for conditions on re-use

Chapter 2: Relational Model Structure of Relational Databases Fundamental Relational-Algebra-Operations Additional Relational-Algebra-Operations Extended Relational-Algebra-Operations Null Values Modification of the Database 2.2

Example of a Relation 2.3

Basic Structure Formally, given sets D 1, D 2,. D n a relation r is a subset of D 1 x D 2 x x D n Thus, a relation is a set of n-tuples (a 1, a 2,, a n ) where each a i D i Example: If customer_name = {Jones, Smith, Curry, Lindsay, } /* Set of all customer names */ customer_street = {Main, North, Park, } /* set of all street names*/ customer_city = {Harrison, Rye, Pittsfield, } /* set of all city names */ Then r = { (Jones, Main, Harrison), (Smith, North, Rye), (Curry, North, Rye), (Lindsay, Park, Pittsfield) } is a relation over customer_name x customer_street x customer_city 2.4

Attribute Types Each attribute of a relation has a name The set of allowed values for each attribute is called the domain of the attribute Attribute values are (normally) required to be atomic; that is, indivisible E.g. the value of an attribute can be an account number, but cannot be a set of account numbers Domain is said to be atomic if all its members are atomic The special value null is a member of every domain The null value causes complications in the definition of many operations We shall ignore the effect of null values in our main presentation and consider their effect later 2.5

Relation Schema A 1, A 2,, A n are attributes R = (A 1, A 2,, A n ) is a relation schema Example: Customer_schema = (customer_name, customer_street, customer_city) r(r) denotes a relation r on the relation schema R Example: customer (Customer_schema) 2.6

Relation Instance The current values (relation instance) of a relation are specified by a table An element t of r is a tuple, represented by a row in a table customer_name customer_street customer_city attributes (or columns) Jones Smith Curry Lindsay Main North North Park Harrison Rye Rye Pittsfield tuples (or rows) customer 2.7

Relations are Unordered Order of tuples is irrelevant (tuples may be stored in an arbitrary order) Example: account relation with unordered tuples 2.8

Database A database consists of multiple relations Information about an enterprise is broken up into parts, with each relation storing one part of the information account : stores information about accounts depositor : stores information about which customer owns which account customer : stores information about customers Storing all information as a single relation such as bank(account_number, balance, customer_name,..) results in repetition of information e.g.,if two customers own an account (What gets repeated?) the need for null values e.g., to represent a customer without an account Normalization theory (Chapter 7) deals with how to design relational schemas 2.9

The customer Relation 2.10

The depositor Relation 2.11

Keys Let K R K is a superkey of R if values for K are sufficient to identify a unique tuple of each possible relation r(r) by possible r we mean a relation r that could exist in the enterprise we are modeling. Example: {customer_name, customer_street} and {customer_name} are both superkeys of Customer, if no two customers can possibly have the same name In real life, an attribute such as customer_id would be used instead of customer_name to uniquely identify customers, but we omit it to keep our examples small, and instead assume customer names are unique. 2.12

Keys (Cont.) K is a candidate key if K is minimal Example: {customer_name} is a candidate key for Customer, since it is a superkey and no subset of it is a superkey. Primary key: a candidate key chosen as the principal means of identifying tuples within a relation Should choose an attribute whose value never, or very rarely, changes. E.g. email address is unique, but may change 2.13

Foreign Keys A relation schema may have an attribute that corresponds to the primary key of another relation. The attribute is called a foreign key. E.g. customer_name and account_number attributes of depositor are foreign keys to customer and account respectively. Only values occurring in the primary key attribute of the referenced relation may occur in the foreign key attribute of the referencing relation. Schema diagram 2.14