Entity Relationship Diagram



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

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

2. Conceptual Modeling using the Entity-Relationship Model

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

Exercise 1: Relational Model

ER modelling, Weak Entities, Class Hierarchies, Aggregation

Outline. Data Modeling. Conceptual Design. ER Model Basics: Entities. ER Model Basics: Relationships. Ternary Relationships. Yanlei Diao UMass Amherst

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

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

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

Database Management Systems

Data Modeling. Database Systems: The Complete Book Ch ,

The Entity-Relationship Model

Lecture 6. SQL, Logical DB Design

SCHEMAS AND STATE OF THE DATABASE

three Entity-Relationship Modeling chapter OVERVIEW CHAPTER

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

Foundations of Information Management

Database Design. Database Design I: The Entity-Relationship Model. Entity Type (con t) Chapter 4. Entity: an object that is involved in the enterprise

Chapter 2: Entity-Relationship Model

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

Entity-Relationship Model

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

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

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

Database Design Process

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

The Entity-Relationship Model

Lesson 8: Introduction to Databases E-R Data Modeling

Database Design Process

Database Design and the E-R Model

Conceptual Design Using the Entity-Relationship (ER) Model

Foundations of Information Management

Database Design. Goal: specification of database schema Methodology: E-R Model is viewed as a set of

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

Data Modelling and E-R Diagrams

There are five fields or columns, with names and types as shown above.

Designing a Database Schema

IV. The (Extended) Entity-Relationship Model

Relational Database Concepts

XV. The Entity-Relationship Model

Lecture 12: Entity Relationship Modelling

Relational Database Design: FD s & BCNF

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

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

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

DATABASE INTRODUCTION

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #5: En-ty/Rela-onal Models- - - Part 1

Winter Winter

How To Write A Diagram

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

1 Class Diagrams and Entity Relationship Diagrams (ERD)

Review Entity-Relationship Diagrams and the Relational Model. Data Models. Review. Why Study the Relational Model? Steps in Database Design

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

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

Databases and BigData

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

Database Fundamentals: 1

- Eliminating redundant data - Ensuring data dependencies makes sense. ie:- data is stored logically

Using Entity-Relationship Diagrams To Count Data Functions Ian Brown, CFPS Booz Allen Hamilton 8283 Greensboro Dr. McLean, VA USA

Data Modeling Basics

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

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

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

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

DATABASE MANAGEMENT SYSTEMS. Question Bank:

EXTENDED LEARNING MODULE A

The Entity-Relationship Model

City University of Hong Kong. Information on a Course offered by Department of Computer Science with effect from Semester A in 2014 / 2015

Lecture Notes INFORMATION RESOURCES

Introduction to normalization. Introduction to normalization

Carnegie Mellon Univ. Dept. of Computer Science Database Applications. Overview - detailed. Goal. Faloutsos CMU SCS

EECS 647: Introduction to Database Systems

Normalization in OODB Design

Fundamentals of Database Design

7. Classification. Business value. Structuring (repetition) Automation. Classification (after Leymann/Roller) Automation.

Database IST400/600. Jian Qin. A collection of data? A computer system? Everything you collected for your group project?

CSC 742 Database Management Systems

ECS 165A: Introduction to Database Systems

ComponentNo. C_Description UnitOfMeasure. C_Quantity

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

Review: Participation Constraints

CSCI-GA Database Systems Lecture 7: Schema Refinement and Normalization

Once the schema has been designed, it can be implemented in the RDBMS.

7.1 The Information system

SQL NULL s, Constraints, Triggers

Chapter 1: Introduction. Database Management System (DBMS) University Database Example

Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Query optimization. DBMS Architecture. Query optimizer. Query optimizer.

Entity/Relationship Modelling. Database Systems Lecture 4 Natasha Alechina

Data Modeling with Entity-Relationship Diagrams

7. Databases and Database Management Systems

Database System Concepts

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

Lecture 2 Normalization

Conceptual Design: Entity Relationship Models. Objectives. Overview

GEOL 452/552 - GIS for Geoscientists I. Lecture 9

The Relational Model. Why Study the Relational Model?

Chapter 2: Designing XML DTDs

Methods Integration. Data Modelling in ZIM. Paper: V. Kasurinen and K. Sere. Proceedings of the Methods Integration Workshop, Leeds, March 1996

Transcription:

Yufei Tao Department of Computer Science and Engineering Chinese University of Hong Kong

A primary goal of database design is to decide what tables to create. Usually, there are two principles: 1 Capture all the information that needs to be captured by the underlying application. 2 Achieve the above with little redundancy. The first principle is enforced with an entity relationship (ER) diagram, while the second with normalization. This lecture focuses on the ER diagram.

An ER diagram is a pictorial representation of the information that can be captured by a database. Such a picture serves two purposes: It allows database professionals to describe an overall design concisely yet accurately. (Most of) it can be easily transformed into the relational schema.

An ER Diagram pid hkid cid title dept PROF TEACH CLASS year rank salary dept grade TAKE STU sid dept gpa

Entity Set An entity is an atomic object that needs to be represented in the database. An entity set is a set of entities with common attributes. For example, a professor is an entity. PROF is an entity set with all the professors. The following shows how to describe in an ER-diagram the entity set PROF with attributes pid, hkid, dept, rank, salary, with pid being the primary key. pid hkid dept PROF rank salary

Relationship Set A relationship is an association among several entities that needs to be represented in the database. We will denote the relationship as (e 1, e 2,..., e n ), where e 1,...e n are the entities participating in the relationship. A relationship set is a set R of relationships (e 1,..., e n ), where each e i comes from the same entity set E i, for 1 i n. Example: The following shows a relationship set R between entity sets A and B. A a 1 a 2 a 3 B b 1 b 2 b 3 b 4 b 5 R = {(a 1, b 1 ), (a 1, b 4 ), (a 2, b 2 ), (a 2, b 4 ), (a 3, b 3 )}.

The next few slides will discuss binary relationship sets, i.e., n = 2. For such relationship sets, we can impose two types of constraints. Cardinality constraint: One-to-one. One-to-many (or conversely, many-to-one). many-to-many. Participation constraint: Total. Partial. We will first talk about cardinality constraints.

One-to-One A relationship set R between entity sets A and B is one-to-one if every entity in A and B can participate in at most one relationship in R. A a 1 a 2 a 3 B b 1 b 2 b 3 b 4 b 5 Example: Husbands and wifes.

One-to-Many A relationship set R between entity sets A and B is one-to-many if every entity in A can participate in any number of relationships in R, but an entity in B can participate in at most one relationship in R. A a 1 a 2 a 3 B b 1 b 2 b 3 b 4 b 5 Example: Parents and Children. Many-to-one is defined analogously.

Many-to-Many A relationship set R between entity sets A and B is many-to-many if every entity in A and B can participate in any number of relationships in R. A a 1 a 2 a 3 B b 1 b 2 b 3 b 4 b 5 Example: Students and classes.

Cardinality constraint: One-to-one. One-to-many (or conversely, many-to-one). many-to-many. Participation constraint: Total. Partial. Next we talk about participation constraints.

Total/Partial Participation Let R be a relationship set between entity sets A and B. The participation of A is total if every entity of A must participate in at least one relationship in R. Otherwise, the participation of A is partial. Likewise, we can define total or participation of B. Example: In the following relationship, the participation of A is total, while that of B is partial. A a 1 a 2 a 3 B b 1 b 2 b 3 b 4 b 5 Patents and professors.

Representation a Relationship Set in ER Diagrams Basic representation of a binary relationship set R between entity sets A and B. A R B The line connecting A and R may: Carry an arrow: Meaning one (as in one-to-many). Not carry an arrow: Meaning many. Be a double line: Meaning total participation. Be a single line: Meaning partial participation.

Examples: A R B Many-to-many, partial participation on both A R B One-to-one, total (partial) participation on left (right) A R B Many-to-one, total (partial) participation on left (right)

Representation a 3-way relationship set: B A R C Example: Professors, students, and projects.

We can associate a relationship set with attributes: grade STU R CLASS What is its difference from the design below? grade STU R CLASS

Revisit the ER diagram on Slide 4 to understand all of its components.