Information Systems Engineering

Similar documents
Information Systems Engineering. Entity Relationship Model

High-Level Database Models. Spring 2011 Instructor: Hassan Khosravi

Steps in designing a database. Steps in picture. Entity-Relationship Model. Entity Set. Attributes. The Entity-Relationship Data Model

ENTITY-RELATIONSHIP MODEL

Conceptual Design with ER Model

ENTITY-RELATIONSHIP MODEL. CS 564- Spring 2018

The Entity-Relationship Model. Steps in Database Design

OVERVIEW OF DATABASE DEVELOPMENT

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

Conceptual Data Models for Database Design

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

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

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

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

CMPT 354 Database Systems I

Information Systems Engineering. SQL Structured Query Language DML Data Manipulation (sub)language

2. E/R Design Considerations

Entity-Relationship Models: Good Design and Constraints

COSC 304 Introduction to Database Systems. Entity-Relationship Modeling

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1

Information Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language

Database Design Using E/R Model

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


High Level Database Models

Entity-Relationship Model. Purpose of E/R Model

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

ER to Relational Mapping

Chapter 2: Entity-Relationship Model

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

Database Design Process

CSE 530A. ER Model. Washington University Fall 2013

CS54100: Database Systems

Entity/Relationship Modelling

Chapter 2 ENTITY RELATIONSHIP MODEL

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

Informatics 1: Data & Analysis

Chapter 6: Entity-Relationship Model

Task: Design an ER diagram for that problem. Specify key attributes of each entity type.

Niklas Fors The Relational Data Model 1 / 17

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

II. Data Models. Importance of Data Models. Entity Set (and its attributes) Data Modeling and Data Models. Data Model Basic Building Blocks

Announcement. Relational Database Design Part I. Keys. Relational model: review. Schema vs. data. More examples of keys

High-Level Database Models (ii)

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

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

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

6.1 RELATIONSHIP CONCEPTS

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

Relational Database Design Part I. Announcement. Relational model: review. CPS 116 Introduction to Database Systems

Entity-Relationship Model

The Relational Model

Intro to DB CHAPTER 6

Introduction to Database Design

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

MIS Database Systems Entity-Relationship Model.

Entity-Relationship Model &

LELCTURE 4: ENHANCED ENTITY-RELATIONSHIP MODELING (EER)

Conceptual Design. The Entity-Relationship (ER) Model

Advance Database Management System

Database Design Process. Requirements Collection & Analysis

Convert E/R to Relation

Relational Database Design Part I. Announcements (September 5) Relational model: review. CPS 116 Introduction to Database Systems

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

King Fahd University of Petroleum and Minerals

E/R Diagrams! Converting E/R Diagrams to Relations!

Module 2 : Entity-Relationship Model 15

Introduction to Database Design

ER modeling. Lecture 4

Entity Relationship Modelling

Chapter 7: Entity-Relationship Model

Conceptual Database Design

Introduction to Data Management CSE 344

CS Database Design - Assignments #3 Due on 30 March 2015 (Monday)

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

Chapter 7: Entity-Relationship Model

Represent entities and relations with diagrams

Topic 5: Mapping of EER Diagrams to Relations

Announcements. Database Design. Database Design. Database Design Process. Entity / Relationship Diagrams. Introduction to Data Management CSE 344

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

The Entity Relationship Model

Data Modeling Using the Entity-Relationship (ER) Model

Chapter 5: Structural Modeling

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

Conceptual Data Modeling

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

Chapter 6: Entity-Relationship Model

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

The En'ty Rela'onship Model

CSC 261/461 Database Systems Lecture 7

Chapter 7: Entity-Relationship Model

From ER Diagrams to the Relational Model. Rose-Hulman Institute of Technology Curt Clifton

CSC 261/461 Database Systems Lecture 8. Spring 2018

The Entity-Relationship (ER) Model

Entity Relationship Data Model. Slides by: Shree Jaswal

Chapter 7: Entity-Relationship Model

Lecture 10 - Chapter 7 Entity Relationship Model

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization

CSC 261/461 Database Systems Lecture 6. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101

COMP Instructor: Dimitris Papadias WWW page:

Transcription:

Information Systems Engineering Database Design Data Scenario ER Design Entity Relationship Model Relational DBMS Relational Schema ER Design After the requirements analysis in terms of data needs, a high level design method as the Entity- -Relationship model should be used 1 MIB - ESIN apm@feup 2 ER components represent the relevant data of a scenario, describing a concrete situation Entities are like nouns: the persons, places, things being modeled in the world of a concrete scenario Relationships are like verbs representing an action or possession (e.g. a doctor treats patients, or a clinic has medical specialties) Attributes are like adjectives that describe an entity (e.g. identification numbers, names, dates, phones, price, etc.) Entities Entities can have several instances, differing in their attribute values A collection of several instances of an entity, characterized by the same attributes, but with different values, n entity set The entity instances belonging to an entity set must be all different, meaning that they must differ in at least one attribute value If all entities have differences only on one or some of the attributes, that set constitutes a key Entity Set Example: Key title year length genre Attributes MIB - ESIN apm@feup 3 MIB - ESIN apm@feup 4

Attributes Attributes must be simple values Attributes should not be decomposable in simpler components The set of all possible values of an attribute is its domain The domain can be infinite We can indicate the domain (or type) after the attribute name in an entity title : string year : integer length : float genre : enumeration (scifi, drama, comedy, action) Relationships Relationships usually link two entity sets using a verb, say entity sets A and B Relationships between entity sets A and B are also sets of sequences of entities containing an entity from A and an entity from B say for instance the sequence (a 1, b 1 ) where a 1 A and b 1 B Relationships are usually represented by diamonds with its name inside it, and between the entities that they link Representation of a Relationship owns MIB - ESIN apm@feup 5 MIB - ESIN apm@feup 6 Multiplicity of relationships Multiplicity indicates the possible number of entities from entity sets A and B that the relationship connects If each member of A can be related to at most 1 member of B by a relationship R then we say that R is many-to-one from A to B. If R is both many-to-one from A to B and from B to A we say that R is one-to-one If R is not many-to-one in both directions then we say that it is many-to-many Example In this scenario we have related to their and the Studio that has produced it Also we know the President that commands each Studio acts in Presidents the many end owns Representation of multiplicity the one end produces commands MIB - ESIN apm@feup 7 MIB - ESIN apm@feup 8

Multiway Relationships A multiway relationship involves more than two entity sets Ternary or higher degree relationships are not so common as binary, but some times are convenient Example: In the world of movie making a Studio must celebrate a contract with to act in one of its contracts for Roles in a Relationship When an Entity Set appears more than once in a Relationship we say that it has more than one role in the Relationship For clarity those roles should be named sequel original Examples sequel contracts for actor studio producing studio MIB - ESIN apm@feup 9 MIB - ESIN apm@feup 10 Attributes and Relationships Attributes in a Relationship In the ER model, Relationships can have attributes Those attributes only make sense associated to each sequence (aka tuple) of entities belonging to the relationship Example: The ternary relationship (contract) of slide 9 needs to stipulate the actor salary Salaries may be different for the same actor to each movie, and the same studio pays differently to each actor, also varying from movie to movie contracts salary Attributes and Relationships Attributes from a Relationship as a new Entity It is never necessary to have Relationships with attributes (but it is clearer) The attributes of a Relationship can constitute a new Entity The Relationship must now involve the new Entity Salaries contracts MIB - ESIN apm@feup 11 MIB - ESIN apm@feup 12

Multiway and Binary Relationships Converting from multiway to binary Any multiway Relationship can be converted to a set of equivalent binary Relationships The multiway Relationship becomes a new Entity set containing as entities the elements of the Relationship New many-to-one Relationships are created between the new Entity set and the Entity sets already linked by the multiway Relationship signs makes Contracts Salaries stipulates mentions Weak Entities A weak entity depends or is subordinate to another entity and needs the other entity to be fully characterized The relationship between the dominant entity and the weak entity is called supporting relationship Weak entities and supporting relationships are represented with double borders To distinguish between weak entity instances we may need the dominant keys Every weak entity instance must be related to a dominant entity instance Genus name belongs Species name Ex: Dyospyros virginiana Pinus virginiana Gazella cuvieri Orestias cuvieri MIB - ESIN apm@feup 13 MIB - ESIN apm@feup 14 Referential Integrity Constraint Definition We say that an entity satisfies the referential integrity constraint, relative to a relationship, if every instance of the entity appears in the relationship We note this fact using a small vertical segment meaning that each member of the other entity is mandatorily related (to at least one member) to this entity If the relationship is not mandatory we can use a small circle to note it Subclasses Specifying subclasses Sometimes some entities in an Entity set should have special attributes in addition to the general ones and may belong to special Relationships that make sense only for them If in an Entity set we have some entities in these conditions we can define a subset of the Entity set called a subclass Subclasses are graphically depicted as an Entity set with its specific attributes, but using a special Relationship () represented by a triangle produce at least one optional attributes Cartoons cartoon attributes MIB - ESIN apm@feup 15 MIB - ESIN apm@feup 16

Subclasses ER Model Design Principles Example speaks in Cartoons acts in All instances of a subclass are also instances of the superclass title year length genre Murder Mysteries weapon Rules for good design Faithfulness The design and chosen elements (entities, attributes, relationships) must represent all the relevant facts in the data scenario Also the multiplicity of the relationships must be carefully determined to be the right ones Avoid redundancy Redundancy is dangerous. Not also occupies extra space in concrete implementations, but can conduct to inconsistencies as entities and sequences in relationships are added, updated and deleted Simplicity Avoid introducing more elements in the model than those absolutely necessary for its purpose MIB - ESIN apm@feup 17 MIB - ESIN apm@feup 18 ER Model Design Principles Rules for good design (continued) Choose the right Relationships Don t represent every possible relationship between your entities. Some of them can be deduced from the others (redundancy) Pick the right kind of element Many times we can choose between attributes and a new entity, or multiway relationships versus binary ones, or even relationship attributes and new entities Choose always the simplest faithful design that better adapts to your objectives Some Common Mistakes Fan trap Employees Companies Offices work operate Companies Although the 3 entities are connected with relationships we cannot answer the question which employees work in a certain office? Chasm trap Offices have operate Offices Salesperson sells have Employees Properties CORRECT To what office belongs this property? enlist CORRECT MIB - ESIN apm@feup 19 MIB - ESIN apm@feup 20