Review The Big Picture

Similar documents
Database Design. ER Model. Overview. Introduction to Database Design. UVic C SC 370. Database design can be divided in six major steps:

Introduction to Database Design

Overview. Introduction to Database Design. ER Model. Database Design

Introduction to Database Design

CSE 530A. ER Model. Washington University Fall 2013

MIS Database Systems Entity-Relationship Model.

The Entity-Relationship Model. Overview of Database Design. ER Model Basics. (Ramakrishnan&Gehrke, Chapter 2)

The Entity-Relationship (ER) Model

Introduction to Databases

Database Applications (15-415)

The Entity-Relationship Model

Conceptual Design. The Entity-Relationship (ER) Model

The Entity-Relationship Model

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

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

CIS 330: Web-driven Web Applications. Lecture 2: Introduction to ER Modeling

Agent 7 which languages? skills?

The Entity-Relationship Model. Overview of Database Design

High Level Database Models

OVERVIEW OF DATABASE DEVELOPMENT

CSE 530A. ER Model to Relational Schema. Washington University Fall 2013

The Entity-Relationship Model

CS/INFO 330 Entity-Relationship Modeling. Announcements. Goals of This Lecture. Mirek Riedewald

SQL DDL. CS3 Database Systems Weeks 4-5 SQL DDL Database design. Key Constraints. Inclusion Constraints

The Relational Model

Database Applications (15-415)

The Relational Model

The Entity-Relationship Model. Steps in Database Design

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

CS 146 Database Systems

LAB 2 Notes. Conceptual Design ER. Logical DB Design (relational) Schema Refinement. Physical DD

Introduction to Database Design

Database Management Systems. Chapter 3 Part 2

CSCC43H: Introduction to Databases

Contents. Database. Information Policy. C03. Entity Relationship Model WKU-IP-C03 Database / Entity Relationship Model

Introduction to Data Management. Lecture #3 (Conceptual DB Design) Instructor: Chen Li

Introduction to Data Management. Lecture #2 (Big Picture, Cont.)

Introduction to Data Management. Lecture #2 (Big Picture, Cont.) Instructor: Chen Li

Introduction to Database Design. Dr. Kanda Runapongsa Dept of Computer Engineering Khon Kaen University

CSC 261/461 Database Systems Lecture 10

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

SYLLABUS ADMIN DATABASE SYSTEMS I WEEK 2 THE ENTITY-RELATIONSHIP MODEL. Assignment #2 changed. A2Q1 moved to A3Q1

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

MIT Database Management Systems Lesson 03: Entity Relationship Diagrams

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

CSC 261/461 Database Systems Lecture 8. Fall 2017

Overview of db design Requirement analysis Data to be stored Applications to be built Operations (most frequent) subject to performance requirement

Data Modeling. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke

High-Level Database Models (ii)

The Entity Relationship Model

CS2 Current Technologies Lecture 5: Data Modelling and Design

ER Model Overview. The Entity-Relationship Model. Database Design Process. ER Model Basics

2. DatabaseDesign. Master I Software Engineering. Dr. Imed Bouchrika Dept of Mathematics & Computer Science University of Souk-Ahras

CSC 261/461 Database Systems Lecture 8. Spring 2018

Entity-Relationship Diagrams

Database Systems. Course Administration

Modeling Your Data. Chapter 2. cs542 1

Chapter Outline. Note 1. Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts

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

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

Introduction to Data Management. Lecture #3 (Conceptual DB Design)

Advance Database Management System

Informatics 1: Data & Analysis

II. Review/Expansion of Definitions - Ask class for definitions

The Relational Model

CS 405G: Introduction to Database Systems

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

Mahathma Gandhi University

VARDHAMAN COLLEGE OF ENGINEERING Shamshabad , Hyderabad B.Tech. CSE IV Semester (VCE - R11) T P C 3+1* -- 4 (A1511) DATABASE MANAGEMENT SYSTEMS

COMP Instructor: Dimitris Papadias WWW page:

CS W Introduction to Databases Spring Computer Science Department Columbia University

Relational Database Systems Part 01. Karine Reis Ferreira

ENTITY-RELATIONSHIP MODEL II. CS121: Relational Databases Fall 2017 Lecture 15

Relational Model. Topics. Relational Model. Why Study the Relational Model? Linda Wu (CMPT )


CMPT 354 Database Systems I

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

Introduction to Data Management. Lecture #3 (Conceptual DB Design)

Conceptual Design. The Entity-Relationship (ER) Model

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

8) A top-to-bottom relationship among the items in a database is established by a

Introduction to Data Management. Lecture #2 Intro II & Data Models I

CIS 330: Applied Database Systems

Requirement Analysis & Conceptual Database Design

Represent entities and relations with diagrams

Basant Group of Institution

Name: Answers Q

Part 5: Introduction to Logical Design

CS 2451 Database Systems: Entity-Relationship (ER) Model Algebra

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38

Chapter 2: Entity-Relationship Model

Translating an ER Diagram to a Relational Schema

ER Modeling Data Modeling and the Entity-Relationship (ER) Diagram Pg 1

The Entity-Relationship Model (ER Model) - Part 2

Database Design Using E/R Model

Database Design Process

Introduction to Data Management. Lecture #4 E-R Model, Still Going

CIS 330: Applied Database Systems. ER to Relational Relational Algebra

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

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

Transcription:

CS445 - Introduction to Database Management Systems Fall Semester 2015 LECTURE 6 The Entity-Relationship Model Introduction TEXTBOOK REFERENCE: CHAPTERS 2,3 R&G 1 Review The Big Picture Data Modeling Relational (Mostly Done) E-R Storing Data File Indexes Buffer Pool Management Query Languages SQL (Mostly Done) Relational Algebra (Mostly Done) Query Optimization External Sorting Join Algorithms Query Plans, Cost Estimation 2 1

Steps in Database Design Requirements Analysis User needs; what must database do? Conceptual Design High level description (often done w/er model) Logical Design Translate ER into Relational Schema Schema Refinement Consistency, normalization (eliminates redundancies and related anomalies) Physical Design Consider typical workloads (and sometimes modify database design), select file types and indexes. 3 A Problem with the Relational Model With complicated schemas, it may be hard for a person to understand the structure from the data definition: tables, attributes, keys, and (especially) foreign keys. From assignment #2: Student(sid,s,sex,age,year,gpa) Enroll(sid,grade,d,cno,sectno) Section(d,cno,sectno,p) Prof(p,d) Dept(d,numphds) Course(cno,c,d) What is really going on here? More importantly, how and why was this particular set of schema developed? 4 2

One Solution: The E-R Model Relational model has Tables (relations) with attributes, keys, foreign keys, domain definitions (for attributes) Entity-Relationship model has (in its most basic form) Entities with entity sets, attributes, keys, and domain definitions for attributes Relationships among entities and relationship sets with uniqueness or cardinality constraints. 5 E-R Model: Conceptual Design Define entities and relationships. What information about entities and relationships should be in database? What are the integrity constraints or business rules that hold? A database `schema in the ER Model can be represented pictorially (ER diagrams). Can map an ER diagram into a relational schema, use DDL to enter into DBMS (coming). 6 3

ER Model: Google 9/25/2015 CS445 DATABASES: LECTURE 11 7 ER Model: Scary Often on walls for production databases! 9/25/2015 CS445 DATABASES: LECTURE 11 8 4

ER Model Basics: Use https://www.draw.io/! Entity: Real-world thing, distinguishable from other objects. Entity described by set of attributes Entity Set: A collection of similar entities. e.g., all employees. All entities in an entity set (in boxes) have the same set of attributes (in circles). Each entity set has a key (underlined). Each attribute has a domain (not shown below). ER Diagram UML Equivalent 9 ER Model Basics (Contd.) d did budget Works_In Departments Relationship: Association among two or more entities. E.g., Lane works in Math and CS Department. relationships can have their own attributes. Relationship Set: Collection of similar relationships 10 5

Example: The E-R Model Works_In Relationship Set Departments Entity Set d did budget Works_In Departments Entity Set 11 Instance: Works_In Relationship Set What information do we need to record a relationship? Must indicate which employee and which department we want connected. That is, we need the key value for an employee and the key value for the department! 1/1/14 123-22-3666 231-31-5368 131-24-3650 223-32-6316 3/3/14 2/2/15 3/1/15 9/23/15 51 56 60 Works_In Departments 12 6

Cardinality Constraints on Relationship Types How many entities can participate? x..y means at least x and at most y * means many did d budget 0..* Works_In 0..1 Departments A given department can have 0 or many employees. A given employee can work in 0 or 1 department. 13 Choosing Cardinality Constraints The correct choice of cardinalities depends on the application requirements Which of the following is correct??? 1..1 0..* Employee Works in Department 0..* 0..1 Employee Works in Department One to many: 1..1 0..* Many to one: 0..* 0..1 0..* 1..* Employee Works in Department Many to many: 0..* 1..* 14 7

Key Constraint Bad terminology! Doesn t necessarily relate to keys! Instead, a key constraint limits participation to at most 1 entity. 0..* 0..1 Employee Works in Department Employee Works in Department Text uses different notation: A key constraint (arrow) limits participation to at most 1 entity. (That is, each Employee entity can participate in at most one Works in relationship.) 15 Participation Constraint A participation constraint forces entities to participate in relationships. 1..1 0..1 Employee manages Department Employee manages Department Text uses different notation: A participation constraint (bold line) limits participation to at least 1 entity. (That is, each Department entity must participate in at least one manages relationship.) 16 8

Key and Participation Constraints Both constraints can be mixed. When neither is used 0..* is assumed. 1..1 0..1 Employee manages Department Employee manages Department Each employee can be managed by at most one department (arrow limits to one, not bold may be zero) Each Department is managed by one and only one employee (arrow limits to one, bold forces at least one) 17 Practice A club has a, office, and phone and is uniquely identified by its Clubs sponsor various events, and each event has one main sponsor but may have other co-sponsors Each event has a title, date, location, and description, and is uniquely identified by the title and date Draw the ER diagram in standard notation, showing all key and participation constraints. 9/25/2015 CS445 DATABASES: LECTURE 11 18 9

Relationship types can have role s did d budget Employee 1..1 0..1 manages managed-by manages Department 19 Key and Participation Constraints Summary Using the text s notation, we can have both the Manages and Works_In relationships in one ER diagram: did d budget Manages Departments Means: at least one Works_In Means: exactly one 20 10

ER Model Basics: Another Example Same entity set can participate in different relationship sets, or in different roles in the same set. did d budget subordinate supervisor Departments Works_In Reports_To 21 Weak Entities A weak entity can be identified uniquely only by considering the primary key of another (owner) entity. Owner entity set and weak entity set must participate in a one-tomany relationship set (one owner, many weak entities). Weak entity set must have total participation in this identifying relationship set. Owner entity set Exactly one: Participation Weak entity set and key constraint! cost p age Policy Dependents Weak entities have only a partial key (dashed underline) 22 11

Weak Entities: UML policy 1..1 0..* Dependents p age cost 23 12