Relational Model (cont d) & Entity Relational Model. Lecture 2

Similar documents
Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 4 Entity Relationship (ER) Modeling

Chapter 4 Entity Relationship Modeling In this chapter, you will learn:

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 4 Entity Relationship (ER) Modeling

Chapter 4. In this chapter, you will learn:

DATABASE SYSTEMS. Chapter 5 Entity Relationship (ER) Modelling DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT

Chapter # 4 Entity Relationship (ER) Modeling

Non-overlappingoverlapping. Final outcome of the worked example On pages R&C pages R&C page 157 Fig 3.52

A l Ain University Of Science and Technology

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

A l Ain University Of Science and Technology

The Entity-Relationship Model. The Entity-Relationship model. The ER model. The Entity-Relationship model. E-R Model Constructs. E-R Model Constructs

More on the Chen Notation

Entity Relationship Modeling. From Rob and Coronel (2004), Database Systems: Design, Implementation, and Management

Represent entities and relations with diagrams

LECTURE 3: ENTITY-RELATIONSHIP MODELING

Chapter 2 Conceptual Modeling. Objectives

Data Analysis 1. Chapter 2.1 V3.1. Napier University Dr Gordon Russell

Entity Relationship Modelling

Related download: Instructor Manual for Modern Database Management 12th Edition by Hoffer Venkataraman Topi (Case studies included)

THE RELATIONAL DATABASE MODEL

Conceptual Database Design (ER modeling) Chapter Three

Essentials of Database Management (Hoffer et al.) Chapter 2 Modeling Data in the Organization

Objectives Definition iti of terms Importance of data modeling Write good names and definitions for entities, relationships, and attributes Distinguis

System Analysis And Design Methods ENTITY RELATIONSHIP DIAGRAM (ERD) Prof. Ali Khaleghi Eng. Hadi Haedar

1/24/2012. Chapter 7 Outline. Chapter 7 Outline (cont d.) CS 440: Database Management Systems

Full file at

The entity is an object of interest to the end user. entity correspond to the table not to a row- in the relational environment.

IS 263 Database Concepts

Objectives of logical design... Transforming the ERD diagram into relations. Relational database components. Mapping a composite attribute

Lecture3: Data Modeling Using the Entity-Relationship Model.

Unit 2 - Data Modeling. Pratian Technologies (India) Pvt. Ltd.


Entity Attribute STUDENT TABLE tuples single domain

Agenda: Understanding Relationship Types Degree and Cardinality with Examples

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 8 Data Modeling Advanced Concepts

Chapter 2: Entity-Relationship Model. Entity Sets. Entity Sets customer and loan. Attributes. Relationship Sets. A database can be modeled as:

Entity Relationship (ER) Modeling

ER modeling. Lecture 4

Database Management System 6 ER Modeling...

Chapter 3B Objectives. Relational Set Operators. Relational Set Operators. Relational Algebra Operations

course 3 Levels of Database Design CSCI 403 Database Management Mines Courses ERD Attributes Entities title 9/26/2018

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

Attributes. Entity-Relationship Model (ERM) IV. Entity Relationship Modeling. Entities and Attributes: Chen and Crow s Foot

David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation

Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys

Database Systems. Overview - important points. Lecture 5. Some introductory information ERD diagrams Normalization Other stuff 08/03/2015

Conceptual Database Design. COSC 304 Introduction to Database Systems. Entity-Relationship Modeling. Entity-Relationship Modeling

Database Systems ER Model. A.R. Hurson 323 CS Building

System Analysis & design

Chapter 3 Database Modeling and Design II. Database Modeling

Advance Database Management System

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E)

Elements of the E-R Model

Chapter 2 ENTITY RELATIONSHIP MODEL

Discussion Focus. Figure 1

ER DIAGRAM ER) diagram, a graphical representation of entities and their relationships to each other, typically used in computing in regard to the

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

The Entity Relationship Model

Review -Chapter 4. Review -Chapter 5

Chapter 2: Entity-Relationship Model

Entity-Relationship Model

Entity-Relationship Model &

Full file at Chapter 2: Foundation Concepts

Entity Relationship Diagram (ERD): Basics

Chapter 1: The Database Environment

Sahaj Computer Solutions. Data Modeling using the Entity Relationship Model

Data Modeling Using the Entity-Relationship Model

Chapter 7: Entity-Relationship Model

COMP Instructor: Dimitris Papadias WWW page:

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model

Institute of Southern Punjab, Multan

Conceptual Data Modeling and the Entity- Relationship Model. Department of Computer Science Northern Illinois University September 2014

Data Modeling with the Entity Relationship Model. CS157A Chris Pollett Sept. 7, 2005.

Lecture 09. Spring 2018 Borough of Manhattan Community College

COSC 304 Introduction to Database Systems. Entity-Relationship Modeling

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam

Database Management Systems LECTURE NOTES 2

Chapter 6: Entity-Relationship Model

Data and Process Modeling

CSIT5300: Advanced Database Systems

Chapter 7: Entity-Relationship Model

COMP 244. Entity Relationship Model Basics. Entity-Relationship Models. Key elements of the E-R model DATABASE CONCEPTS & APPLICATIONS

4. Entity Relationship Model

ER-to-Relational Mapping

Entity-Relationship Model. From Chapter 5, Kroenke book

Roadmap of This Lecture. Weak Entity Sets Extended E-R Features Reduction to Relation Schemas Database Design UML*

CMP-3440 Database Systems

Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts

Data Modeling Using the Entity-Relationship (ER) Model

Entity Relationship Diagram (ERD) Dr. Moustafa Elazhary

Lecture4: Guidelines for good relational design Mapping ERD to Relation. Ref. Chapter3

ER Model. Objectives (2/2) Electricite Du Laos (EDL) Dr. Kanda Runapongsa Saikaew, Computer Engineering, KKU 1

Distributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science

Conceptual Data Models for Database Design

Chapter 9: Relational DB Design byer/eer to Relational Mapping Relational Database Design Using ER-to- Relational Mapping Mapping EER Model

CSC 261/461 Database Systems Lecture 7

6.1 RELATIONSHIP CONCEPTS

PES Institute of Technology Bangalore South Campus (1 K.M before Electronic City,Bangalore ) Department of MCA. Solution Set - Test-II

Transcription:

Relational Model (cont d) & Entity Relational Model Lecture 2

Relational Database Operators Relational algebra Defines theoretical way of manipulating table contents using relational operators: SELECT PROJECT JOIN INTERSECT UNION DIFFERENCE PRODUCT Use of relational algebra operators on existing tables (relations) produces new relations 2

Relational Algebra Operators Union: Combines all rows from two tables, excluding duplicate rows Tables must have the same attribute characteristics Intersect: Yields only the rows that appear in both tables 3

Union 4

Intersect 5

Relational Algebra Operators Difference Yields all rows in one table not found in the other table that is, it subtracts one table from the other 6

Venn Diagrams for Traditional Set Operators Union Intersection Differences 7

Product: Yields all possible pairs of rows from two tables 8

Relational Algebra Operators Select Yields values for all rows found in a table Can be used to list either all row values or it can yield only those row values that match a specified criterion Yields a horizontal subset of a table Project Yields all values for selected attributes Yields a vertical subset of a table 9

Select 10

Project 11

Join Relational Algebra Operators Allows us to combine information from two or more tables Real power behind the relational database, allowing the use of independent tables linked by common attributes 12

Natural Join Process Links tables by selecting rows with common values in common attribute(s) Three-stage process Product creates one table Select yields appropriate rows Project yields single copy of each attribute to eliminate duplicate columns 13

Natural Join Final outcome yields table that Does not include unmatched pairs Provides only copies of matches If no match is made between the table rows, no rows will be produced in the resultant table the new table does not include the unmatched row 14

Entity Relationship (ER) Model ER model forms the basis of an ER diagram ERD represents the conceptual database as viewed by end user ERDs depict the ER model s three main components: Entities Attributes Relationships 16

Entities Refers to the entity set and not to a single entity occurrence Corresponds to a table and not to a row in the relational environment In both the Chen and Crow s Foot models, an entity is represented by a rectangle containing the entity s name Entity name, a noun, is usually written in capital letters 17

Attributes Characteristics of entities Domain is set of possible values Primary keys underlined 18

Examples EMPLOYEE (EMPLOYEE _ID, EMPLOYEE _NAME, ADDRESS, DATE-EMPLOYED) EMPLOYEE _NAME EMPLOYEE _ID EMPLOYEE ADDRESS DATE- EMPLOYED EMPLOYEE EMPLOYEE _ID EMPLOYEE _NAME ADDRESS DATE-EMPLOYED 19

Simple Cannot be subdivided Age, sex, marital status Composite Can be subdivided into additional attributes Address into street, city, zip Single-valued Can have only a single value Person has one social security number Attributes Multi-valued Can have many values Person may have several college degrees In the Chen E-R model, the multivalued attributes are shown by a double line connecting the attributes to the entity Derived Can be derived with algorithm Age can be derived from date of birth Versus stored attribute 20

An attribute broken into component parts Attributes Address Street_Address City State Post_Code 21

Attributes Entity with a multivalued attribute (Skill) and derived attribute (Years_Employed) Employee_ID Employee_Name Address Years_Employed EMPLOYEE Skills Date_Employed 22

How to Deal with Multivalued Attributes With the original entity, create several new attributes, one for each of the original multivalued attribute s components. Create a new entity composed of the original multivalued attribute s components. 23

An Example Mod_code Car_Year Car_Vin CAR Car_Color 24

Relationships Association between entities Connected entities are called participants Operate in both directions Connectivity describes relationship classification 1:1, 1:M, M:N Cardinality Expresses number of entity occurrences associated with one occurrence of related entity 27

ERD Symbols Rectangles represent entities Diamonds represent the relationship(s) between the 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 28

Connectivity and Cardinality in an ERD (1,1) (1,4) (1,1) (1,4) 29

Relationship Strength Existence dependence Entity s existence depends on existence of related entities Weak entity Existence-independent entities can exist apart from related entities Strong entity or regular entity EMPLOYEE claims DEPENDENT (a mandatory foreign key) Weak (non-identifying) relation PK of related entity doesn t contain PK component of parent entity Strong (identifying) relation PK of related entity contains PK component of parent entity 30

Weak Entity Existence-dependent on another entity Foreign keys should be on many side (1,1) (0,N) Mandatory foreign keys from parent entity 31

Weak Relationship

Strong Relationship

Optional Relationship Participation Entity occurrence does not require a corresponding occurrence in related entity Shown by drawing a small circle on side of optional entity on ERD Mandatory Entity occurrence requires corresponding occurrence in related entity If no optionality symbol is shown on ERD, it is mandatory 34

Relationship Types Indicates number of associated entities Unary Single entity Exists between occurrences of same entity set Binary Two entities associated Most common To simplify the conceptual design, most higher-order relationships are decomposed into appropriate equivalent relationships when possible Ternary Three entities associated 35

Three Types of Relationships 36

Recursive Relationship Definition: A relationship can exist between occurrences of the same entity set 1 1 PERSON 1 M EMPLOYEE is married to manages 37

Composite Entities Also known as bridge entities Composed of the primary keys of each of the entities to be connected May also contain additional attributes that play no role in the connective process 38

A Composite Entity in an ERD (1,1) (0,N) (0,N) (1,1) 39

Example M:N Relationship 40

Converting M:N Relationship to Two 1:M Relationships 41

ERD design steps General narrative description of operations Identify entities from description Locate relationships among entities If many to many, create bridge entity Repeat above 3 steps until completion

An Example 1 M M 1 STORE ORDER PRODUCT employs M 1 EMPLOYEE claims M DEPENDENT 43

Comparison of E-R Modeling Symbols 44

Developing an E-R Diagram Iterative Process Step1: General narrative of organizational operations developed Step2: Basic E-R Model graphically depicted and reviewed Step3: Modifications made to incorporate newly discovered E-R components Repeat process until designers and users agree E-R Diagram complete 45

Example Create an ERD using the following business rules: A company operates four departments Each department employs employees Each of the employees may or may not have one or more dependents Each employee may or may not have an employment history 46

Exercise Design an E-R diagram for a real estate firm that lists property for sale. The firm has a number of sales offices in several states. Each sales office is assigned one or more employees. Attributes of employees include ID and name. An employee must be assigned to only one sales office. For each sales office, there is always one employee assigned to manage that office. An employee may manage only the sales office to which he is assigned. The firm lists property for sale. Attributes of property include ID and location. Components of location include address, city, state, and Zip_code. Each unit of property must be listed with at least one of the sales offices. A sales office may have any number of properties listed, or may have no properties listed. Each unit of property has one or more owners. An owner may own one or more units of property. An attribute of the relationship between property and owner is Percent_Owned. 47