Database Design Phases. History. Entity-relationship model. ER model basics 9/25/11. Entity-relationship (ER) model. ER model basics II

Similar documents
Identifying entities. Another relationship. Continue exploring our first model for databases: Entity-relationship (ER) model. Identifying entities

Enhanced Entity- Relationship Models (EER)

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

The Entity-Relationship Model. Steps in Database Design

CMPT 354 Database Systems I

Conceptual Data Modeling

ER to Relational Mapping

Database Applications (15-415)

The Entity-Relationship (ER) Model

High Level Database Models

Chapter (4) Enhanced Entity-Relationship and Object Modeling

Entity Relationship Data Model. Slides by: Shree Jaswal

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

CMSC 424 Database design Lecture 3: Entity-Relationship Model. Book: Chap. 1 and 6. Mihai Pop

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

Conceptual Design with ER Model

CSIT5300: Advanced Database Systems

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

Conceptual Data Models for Database Design

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

COMP Instructor: Dimitris Papadias WWW page:

Chapter 2: Entity-Relationship Model

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

High-Level Database Models (ii)

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

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

Entity-Relationship Model

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

The Entity-Relationship (ER) Model 2

COIS Databases

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

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

Ch 9: Mapping EER to Relational. Follow a seven-step algorithm to convert the basic ER model constructs into relations steps 1-7

The Entity-Relationship Model

How to translate ER Model to Relational Model

The Entity-Relationship Model

MIS Database Systems Entity-Relationship Model.

CSE 530A. ER Model. Washington University Fall 2013

Introduction to Database Design

Chapter 6: Entity-Relationship Model

Chapter 4. Enhanced Entity- Relationship Modeling. Enhanced-ER (EER) Model Concepts. Subclasses and Superclasses (1)

The Entity-Relationship Model


Informatics 1: Data & Analysis

Relational DB Design by ER- and EER-to-Relational Mapping Design & Analysis of Database Systems

Database Management Systems. Chapter 2 Part 2

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

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

Chapter 7: Entity-Relationship Model

Introduction to Database Design

Chapter 7: 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.

Chapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model.

CSCC43H: Introduction to Databases

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

The Entity-Relationship Model. Overview of Database Design

THE ENHANCED ER (EER) MODEL CHAPTER 8 (6/E) CHAPTER 4 (5/E)

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes.

Chapter 6: Entity-Relationship Model

CS 338 The Enhanced Entity-Relationship (EER) Model

Chapter 7: Entity-Relationship Model

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

E-R Model. Hi! Here in this lecture we are going to discuss about the E-R Model.

ENTITY-RELATIONSHIP MODEL. CS 564- Spring 2018

Database Management System 6 ER Modeling...

The Relational Model

Intro to DB CHAPTER 6

More on the Chen Notation

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

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

Database Management

Enhanced Entity-Relationship (EER) Modeling

Lecture 5. Lecture 5: The E/R Model

MTAT Introduction to Databases

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

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

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

Object Modeling. Entity-Relationship (ER) diagrams (1976) Object Modelling Technique (OMT) diagrams (1991)

6.1 RELATIONSHIP CONCEPTS

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

Chapter 8: Enhanced ER Model

Lecture 2: Entity Relationship Data Model 2. 1

SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay. Lecture #10 Process Modelling DFD, Function Decomp (Part 2)

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

CMP-3440 Database Systems

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

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

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

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

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

Introduction to Database Design

Chapter 2 ENTITY RELATIONSHIP MODEL

Chapter 7: Entity-Relationship Model

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

Topic 5: Mapping of EER Diagrams to Relations

Lecture 4. Lecture 4: The E/R Model

Information Systems (Informationssysteme)

From ER to Relational Model. Book Chapter 3 (part 2 )

Conceptual Modeling in ER and UML

Chapter 8 The Enhanced Entity- Relationship (EER) Model

Transcription:

CO 597A: Principles of Database and Information ystems Entity-relationship (ER) model Database Design Phases 1. characterize user needs 2. conceptual design structure of data * Entity-relationship model nature of functionality questions modifications 3. implement in database system logical design physical design Entity-relationship model Goal: Capture semantics of information objects Goal: Capture complexity of relationships between objects Used first for database modeling but now expanded use History Developed 1976 Peter Chen after relational model Chen felt relational model not rich enough relational model: everything a (mathematical) relation on collection of domains Di e.g. name from domain of strings Relation subset of D 1 x D 2 x x D k (k-ary) ER model differentiate between objects described attributes and relationships among objects ER model basics An entity is a distinct object in the real world person, book, movie character, disease, conceptual Attributes are basic properties of entities some defs. don t allow substructure for attributes name first name, last name An entity is described/defined its attributes entity is tuple (or set) of attributes attribute is function: entity set domain of attribute values ER model basics II A relationship is a tuple of entities entities are thus related relationship has some meaning (PU store, cute tiger ba shirt) A relationship set is a set of relationships of the same type same type = same component types {stores} X {items for sale} A relationship can have its own attributes different from entity attributes descriptive only cannot use to distinguish two tuples of a relationship set (PU store, cute tiger ba shirt), in stock? 1

Example Entity course with attributes: department, number, semester Entity student with attributes: first name, last name, ID number Relationship take relating: A student to a course Both entities and relationships are tuples but at different granularities We choose which are entities and which are relationships We choose attributes that best describe entities We choose semantics of a relationship between entities Board Example Another relationship Entity : (title, IBN#, edition, date) Entity : (name, gender, birth date, place of birth, date of death) Entity : (name, country, address) Relationship written : (books, authors) Relationship sequel: (books, books) Any book can be on either side of relationship If sequence longer than 2, middle book appears in tuple on each side Meaning of first entry: precedes equel Meaning of second entry: follows Relationship published : (books, publishers, in print) Example tuples for Lord of the Rings: (Fellowship of the Ring, Twin Towers) (Twin Towers, Return of the King) ummary: Entity An entity is an element of A 1 x A 2 x x A k where A i is the domain of values of the i th attribute of the entity (for entity with k attributes) A 1 x A 2 x x A k it the type of the entity et of entities of same type entity set ummary: Relationship A relationship is an element of E 1 x E 2 x x E m x A 1 x A 2 x x A p where E 1,, E m are entity types ( for relationship between m entities) and A i is the domain of values of the i th attribute of the entity for an entity with p attributes E 1 x E 2 x x E m x A 1 x A 2 x x A p is the type of the relationship et of relationships of same type relationship set Use of attributes is constrained so that for relationships (e 1, e m, a 1,, a p ) and (e 1, e m, a 1,, a p ), if (e 1, e m ) = (e 1, e m ) then (a 1,, a p ) = (a 1,, a p ) 2

Identifying entities Constraints Key: a minimal* set of attributes whose values uniquely identify each entity in an entity set represents a book * No subset will do the job Identifying entities Key: a minimal set of attributes whose values uniquely identify each entity in an entity set Candidate Key: any key Primary key: a candidate key defined to be primary person who defines entity Denote primary key underlining attributes Entity : (title, IBN#, edition, date) Entity : (name, gender, birth date, place of birth, date of death) Entity : (name, country, address) uperkey: any set of attributes that contains a candidate key Constraints on entities Declaring a candidate key constrains values of attributes What about constraints on relationships? Constraints are statements about structure Example: IBN# as key No book without an IBN# No two books with same IBN# 3

How many entities have link? How many links per entity? published Two major constraints for relationships Key constraint on an entity type participating in a relationship type: Each entity of the entity type appears in at most one tuple of the relationship type Equivalently, the value of the key-constrained entity determines the values of the other entities in a relationship tuple Total Participation constraint of an entity type participating in a relationship type: Every entity in the entity set of the entity type appears in a tuple of the relationship Example: key constraint on books for published? YE But remember NOT inspection!! Example: key constraint on books for written? NO But remember NOT inspection!! published written published written Example: total participation constraint on books for written? YE all books authored someone Fill in rest of constraints on board diagram written watch what constraint means watch intended use of database written 4

Multiple Key Constraints can have binary relationship where both entity sets satisfy key constraint i.e. both entity sets keys for relationship Multiple Key Constraints can have binary relationship where both entity sets satisfy key constraint i.e. both entity sets keys for relationship Faculty in U president of U Universities Faculty in U president of U Universities Total participation constraints? Constraints cannot denote in basic ER model Domain attribute constraints within entity Need to test values of attributes not simply membership properties in sets Example: Attribute NJ driver: yes/no flag Attribute age: number Constraint if age <17 then NJ driver == no Constraints cannot denote in basic ER model Functional constraints Example: person entity with 6 attributes: first name, last name, street address, state, area code, 7-digit phone number. Constraint: if area code of person 1 = area code of person 2 then state of person 1 = state of person 2 Equivalently, area code determines state Constraints cannot denote in basic ER model Functional constraints General form: Let A and B be subsets of attributes for an entity type. For any entities e j and e k of the type: If the values of attributes in set A for tuple e j equal the values of attributes in set A for tuple e k Then the values of attributes in set B for tuple e j equal the values of attributes in set B for tuple e k Constraints cannot denote in basic ER model Functional constraints More complicated example: customer entity with 8 attributes: height, weight, arm length, leg length, color preference, jacket size, pant size, shirt size Constraint: Height, weight, arm length determine shirt size Height, weight, leg length determine pant size 5

n-ary relationships, n>2 Example- scheme: tutorial offering = Tutorials X Instructors X Conferences Richness of ER model Do with binary relationships? Capturing constraints. Careful! Richness of ER model 1. Tuples can be composed of tuples hierarchy: Relationship tuples composed of entity tuples By aggregation, relationship tuples can contain relationship tuples Aggregation tutorial offering = Tutorials X Conferences X Contacts tutorial offering = [Tutorials X Conferences] X Contacts 2. Inheritance for entities: An entity type can be further refined because wanted Tutorials X Conferences as key express constraint Diagram Aggregation Tutorials Examples when need for semantics? conference tutorial tutorial offering Contacts to board Conferences 6

key et of (strong) Owner entities et of Weak entities attribute attribute ownership partial key Weak entity Weak entity only completely identified when related to owner entity Weak entity set has no key Weak entity has partial key (aka discriminator) Owner key + partial key = key for weak entity Weak entity fully participates in ownership relationship Weak entity is key for ownership relationship key constraint on weak entity in ownership relationship Richness of ER model 1. Tuples can be composed of tuples hierarchy: Relationship tuples composed of entity tuples By aggregation, relationship tuples can contain relationship tuples 2. Inheritance for entities: An entity type can be further refined Inheritance hierarchy for entities Using hierarchy with relationships title edition IBN# date title edition IBN# date Published Number contributors Number contributors Authored Editors Contributor To Authored Written Key and total participation constraints possible title edition IBN# date Published We just declared constraints: 1. A book is published at most one publisher (key constraint) Number contributors Editors Contributor To Authored Written 2. Every authored book is written some author (total participation constraint) 3. Every edited book is edited some editor (total participation constraint) 7

Constraints on is a decomposition Covering If union of subclasses = superclass = 1 U 2 Overlapping If subclasses can overlap 1 2 may Ø 1 1 2 2 Overlapping? Covering? title Number contributors Editors edition Contributor To IBN# date Authored Published Written GENERAL GENERAL Can have > 2 subclasses for one 1 2 3 Can have more that one refinement for an entity ubclasses can be further refined with Deep hierarchy possible 1 2 3 1 2 3 T1 T2 2.1 2.2 2.1 2.2 Another example ummary Class yr name PU people address tudent Employee ID # Pay scale ER model is rich model for describing objects and their relationships Can capture: constraints Aggregations of objects into more complex objects Different decompositions of entity types Deep hierarchy of decomposition Model used as first effort to organize information and make precise what is needed 8