CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING

Similar documents
Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model

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

Chapter 3. Data Modeling Using the Entity-Relationship (ER) Model

Chapter 2: Entity-Relationship Model. E-R R Diagrams

Chapter 2: Entity-Relationship Model. Entity Sets. " Example: specific person, company, event, plant

We know how to query a database using SQL. A set of tables and their schemas are given Data are properly loaded

Chapter 2: Entity-Relationship Model

Entity-Relationship Model

not necessarily strictly sequential feedback loops exist, i.e. may need to revisit earlier stages during a later stage

ER modelling, Weak Entities, Class Hierarchies, Aggregation

The Entity-Relationship Model

Entity Relationship Diagram

Lesson 8: Introduction to Databases E-R Data Modeling

DATABASE DESIGN. - Developing database and information systems is performed using a development lifecycle, which consists of a series of steps.

COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model

CSC 742 Database Management Systems

2. Conceptual Modeling using the Entity-Relationship Model

Bridge from Entity Relationship modeling to creating SQL databases, tables, & relations

Database Management Systems

three Entity-Relationship Modeling chapter OVERVIEW CHAPTER

Data Analysis 1. SET08104 Database Systems. Napier University

IV. The (Extended) Entity-Relationship Model

Foundations of Information Management

Lecture 12: Entity Relationship Modelling

Unit 2.1. Data Analysis 1 - V Data Analysis 1. Dr Gordon Russell, Napier University

Converting E-R Diagrams to Relational Model. Winter Lecture 17

Database Design Process

Database Design Methodology

XV. The Entity-Relationship Model

Database Design Process

Requirement Analysis & Conceptual Database Design. Problem analysis Entity Relationship notation Integrity constraints Generalization

Database Design Overview. Conceptual Design ER Model. Entities and Entity Sets. Entity Set Representation. Keys

Database Systems. Session 3 Main Theme. Enterprise Data Modeling Using The Entity/Relationship (ER) Model. Dr. Jean-Claude Franchitti

The E-R èentity-relationshipè data model views the real world as a set of basic objects èentitiesè and

Concepts of Database Management Seventh Edition. Chapter 6 Database Design 2: Design Method

Data Modelling and E-R Diagrams

Relational Schema Design

SCHEMAS AND STATE OF THE DATABASE

OVERVIEW 1.1 DATABASE MANAGEMENT SYSTEM (DBMS) DEFINITION:-

Designing a Database Schema

Data Modeling: Part 1. Entity Relationship (ER) Model

CHAPTER 3: DATA MODELING USING THE ENTITY-RELATIONSHIP MODEL

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

Database Design Process. Databases - Entity-Relationship Modelling. Requirements Analysis. Database Design

Relational Database Concepts

An Example: Video Rental System

DATABASE MANAGEMENT SYSTEMS. Question Bank:

Foundations of Information Management

The Relational Model. Why Study the Relational Model? Relational Database: Definitions. Chapter 3

LiTH, Tekniska högskolan vid Linköpings universitet 1(7) IDA, Institutionen för datavetenskap Juha Takkinen

BİL 354 Veritabanı Sistemleri. Entity-Relationship Model

7.1 The Information system

Data Modeling Basics

Exercise 1: Relational Model

Modern Systems Analysis and Design

Conceptual Design: Entity Relationship Models. Objectives. Overview

Data Modeling. Database Systems: The Complete Book Ch ,

Relational Database Basics Review

The Relational Model. Why Study the Relational Model? Relational Database: Definitions

A brief overview of developing a conceptual data model as the first step in creating a relational database.

CS 377 Database Systems. Database Design Theory and Normalization. Li Xiong Department of Mathematics and Computer Science Emory University

Fundamentals of Database System

Database Design Methodologies

Database Fundamentals: 1

The Relational Data Model: Structure

IT2305 Database Systems I (Compulsory)

Fundamentals of Database Design

Database Design and the E-R Model

Introduction to normalization. Introduction to normalization

A. TRUE-FALSE: GROUP 2 PRACTICE EXAMPLES FOR THE REVIEW QUIZ:

Databases Model the Real World. The Entity- Relationship Model. Conceptual Design. Steps in Database Design. ER Model Basics. ER Model Basics (Contd.

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. The Relational Model. The relational model

Database Design Methodology

AVOIDANCE OF CYCLICAL REFERENCE OF FOREIGN KEYS IN DATA MODELING USING THE ENTITY-RELATIONSHIP MODEL

Entity/Relationship Modelling. Database Systems Lecture 4 Natasha Alechina

IT2304: Database Systems 1 (DBS 1)

The Entity-Relationship Model

Entity - Relationship Modelling

How To Write A Diagram

Databases -Normalization III. (N Spadaccini 2010 and W Liu 2012) Databases - Normalization III 1 / 31

Information Systems Analysis and Design CSC John Mylopoulos Database Design Information Systems Analysis and Design CSC340

Introduction to Computing. Lectured by: Dr. Pham Tran Vu

Doing database design with MySQL

ER & EER to Relational Mapping. Chapter 9 1

Chapter 8 The Enhanced Entity- Relationship (EER) Model

Designing Databases. Introduction

AS LEVEL Computer Application Databases

Relational model. Relational model - practice. Relational Database Definitions 9/27/11. Relational model. Relational Database: Terminology

Lecture Notes INFORMATION RESOURCES

Chapter 10 Functional Dependencies and Normalization for Relational Databases

Database Design. Adrienne Watt. Port Moody

A Comparative Analysis of Entity-Relationship Diagrams 1

Data Modeling with Entity-Relationship Diagrams

The Entity-Relationship Model

Databases What the Specification Says

The Relational Model. Ramakrishnan&Gehrke, Chapter 3 CS4320 1

Lecture 6. SQL, Logical DB Design

1 Class Diagrams and Entity Relationship Diagrams (ERD)

Conceptual Design Using the Entity-Relationship (ER) Model

Transcription:

DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University

2 Quality of Conceptual Schema Correctness. No syntactic or semantic errors. Completeness. All data requirements are captured and all required operations can be executed. Readability. Conceptual schema is self-explanatory. Minimality. There are no redundancies.

3 ENTITY-RELATIONSHIP Conceptual Model Graphical representation of the overall (logical) structure of a database, which is independent of the DBMS in which the database is implemented. Entity Type an object that exists and is distinguishable from other objects (e.g., students); represented by a set of attributes (e.g., student-id, name, major) Entity Extension Relationship Type Relationship Instance set of entities of the same type (e.g., instances of students); entity sets need not be disjoint (e.g., person & customer) an association among several entities (e.g., students taking classes) a set of relationships of the same type (e.g., the instances of which students are taking what classes)

4 DIAGRAM entity type attribute Single-valued multivalued derived composite attribute relationship type links

5 MAPPING CARDINALITIES Mapping cardinalities express the number of entities to which another entity can be associated via a relationship. For a binary relationship set, there are several cardinality ratios: 1:1 (one-to-one) 1:N (one-to-many) N:1 (many-to-one) M:N (many-to-many) The following examples of cardinality ratios are expressed using the abstract entity sets A and B.

6 CARDINALITY RATIOS 1:1 1:1 An entity in A is associated with at most one entity in B. An entity in B is associated with at most one entity in A.

7 CARDINALITY RATIOS 1:N 1:N An entity in A is associated with any number of entities in B. An entity in B is associated with at most one entity in A.

8 CARDINALITY RATIOS M:N M:N An entity in A is associated with any number of entities in B. An entity in B is associated with any number of entities in A.

9 RECURSIVE RELATIONSHIPS

10 NON-BINARY RELATIONSHIPS

11 1:1 RELATIONSHIP Example Assumption: Each department has at most one manager and a manager is the head of at most one department.

12 1:N RELATIONSHIP Example Assumption: Each course is taught by one teacher but a teacher can teach many courses.

13 M:N RELATIONSHIP Example Assumption: A country exports more than one product and products can be exported by more than one country.

14 STRUCTURAL CONSTRAINT structural constraint = cardinality + participation ratio constraint Cardinality Ratio Participation Constraint determines the number of relationship instances that an entity participates in for a given relationship type, e.g., 1:1, 1:N, M:N determines the existence dependence of an entity on its participation in a relationship instance total: e.g., an employee must work in a department (denoted by a double edge on ER diagram) partial: e.g., an employee may be a manager (denoted by a single edge on ER diagram)

15 MIN/MAX PAIRS To add more meaning (semantics), associate a (min,max) pair with an entity type E in relationship type R 0=<min=<max and max>=1 An entity e in E must participate in at least min and at most max relationship instances in R at all times. min = 0 : partial participation min > 0 : total participation

16 MIN/MAX EXAMPLE An employee need not be a manager but if a manager, manages exactly one department. A department must have exactly one manager. An employee works in exactly one department. A department must have at least one employee, but many employees can work in a department.

17 KEYS Since an entity is distinguishable from other objects, we need to specify a key, which is a set of attributes for an entity type that uniquely identifies an instance of that entity type. Superkey Candidate Key Primary Key A set of one or more attributes, which, taken collectively, allow the unique identification of an entity in its entity type (e.g., {id}, {id name} ). A superkey may contain extra attributes. A superkey for which no proper subset is a superkey (e.g. {id}, {name address}). A candidate key that is chosen by the DBA as the principal means of identifying entities. On an ER diagram, we underline the attribute that is the candidate key for that entity.

18 STRONG vs. WEAK ENTITIES Strong Entity: an entity that has a primary key Weak Entity: an entity that does not have sufficient attributes to primary key form a Consider as an example a dependent entity type with attributes firstname, birthdate and sex. Each dependent is unique for a given employee but different employees may have dependents with the same name and birthdate. The primary key of a weak entity type is formed by the primary key of the entity on which it is existence dependent plus its discriminator (partial key), which is a set of attributes that distinguishes the entities in a weak entity set that depend on its identifying owner. dependent's primary key: {empid, firstname, birthdate}

19 WEAK ENTITY EXAMPLE

20 WEAK ENTITY Notation and Terminology Weak Entity w w Existence Dependent Identifying Relationship i i Identifying Owner o o

21 ER EXERCISE Consider a large company that wants to keep track of the training courses that its employees have taken: An employee has a name, identification number and salary. An employee works in at most one department. A department has a unique number, a name and the identification number of the manager of that department. An employee can take many training courses but can take a given course at most once. Each course is identified by a course number, descriptive name, its instructor and its length in hours. Since a particular course may be offered several times, the date that an employee takes a course is also recorded. Give an ER diagram to represent this enterprise.

22 ER DIAGRAM Your solution Class solution

23 ER EXERCISE Consider a large company that wants to keep track of the training courses that its employees have taken: An employee has a name, identification number and salary. An employee works in at most one department. A department has a unique number, a name and the identification number of the manager of that department. An employee can take many training courses but can take a given course at most once. Each course is identified by a course number, descriptive name, its instructor and its length in hours. Since a particular course may be offered several times, the date that an employee takes a course is also recorded. Give an ER diagram to represent this enterprise.

24 ER EXERCISE Consider a large company that wants to keep track of the training courses that its employees have taken: An employee has a name, identification number and salary. An employee works in at most one department. A department has a unique number, a name and the identification number of the manager of that department. An employee can take many training courses but can take a given course at most once. Each course is identified by a course number, descriptive name, its instructor and its length in hours. Since a particular course may be offered several times, the date that an employee takes a course is also recorded. Give an ER diagram to represent this enterprise.

25 ER EXERCISE Consider a large company that wants to keep track of the training courses that its employees have taken: An employee has a name, identification number and salary. An employee works in at most one department. A department has a unique number, a name and the identification number of the manager of that department. An employee can take many training courses but can take a given course at most once. Each course is identified by a course number, descriptive name, its instructor and its length in hours. Since a particular course may be offered several times, the date that an employee takes a course is also recorded. Give an ER diagram to represent this enterprise.

26 ER EXERCISE Consider a large company that wants to keep track of the training courses that its employees have taken: An employee has a name, identification number and salary. An employee works in at most one department. A department has a unique number, a name and the identification number of the manager of that department. An employee can take many training courses but can take a given course at most once. Each course is identified by a course number, descriptive name, its instructor and its length in hours. Since a particular course may be offered several times, the date that an employee takes a course is also recorded. Give an ER diagram to represent this enterprise.

27 ER EXERCISE Consider a large company that wants to keep track of the training courses that its employees have taken: An employee has a name, identification number and salary. An employee works in at most one department. A department has a unique number, a name and the identification number of the manager of that department. An employee can take many training courses but can take a given course at most once. Each course is identified by a course number, descriptive name, its instructor and its length in hours. Since a particular course may be offered several times, the date that an employee takes a course is also recorded. Give an ER diagram to represent this enterprise.