DATABASE DESIGN I - 1DL300

Similar documents
DATABASE DESIGN I - 1DL300

DATABASTEKNIK - 1DL116

DATABASDESIGN FÖR INGENJÖRER F

DATABASE TECHNOLOGY. Spring An introduction to database systems

DATABASE TECHNOLOGY - 1DL124

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

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

Entity Relationship Data Model. Slides by: Shree Jaswal

Chapter (4) Enhanced Entity-Relationship and Object Modeling

DATABASE DESIGN I - 1DL300

Outline. Note 1. CSIE30600 Database Systems ER/EER to Relational Mapping 2

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

ER-to-Relational Mapping

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

Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping

Chapter 8 The Enhanced Entity- Relationship (EER) Model

CS 405G: Introduction to Database Systems

COIS Databases

Chapter 8: Enhanced ER Model

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

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

A l Ain University Of Science and Technology

Data Modeling Using the Entity-Relationship (ER) Model

LELCTURE 4: ENHANCED ENTITY-RELATIONSHIP MODELING (EER)

Enhanced Entity-Relationship (EER) Modeling

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

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

ER to Relational Mapping

Chapter 2: Entity-Relationship Model

Copyright 2016 Ramez Elmasr and Shamkant B. Navathei

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

A l Ain University Of Science and Technology

Chapter 6: Entity-Relationship Model

Conceptual Data Models for Database Design

Advance Database Management System

Database Management

Chapter 6: Entity-Relationship Model

Overview of Database Design Process. Data Modeling Using the Entity- Relationship (ER) Model. Two main activities:

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

Enhanced Entity- Relationship Models (EER)

DATABASE TECHNOLOGY - 1MB025 (also 1DL029, 1DL300+1DL400)

EECS 647: Introduction to Database Systems

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

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

Data Modeling Using the Entity-Relationship Model

Data Modeling Using the Entity- Relationship Model Design & Analysis of Database Systems

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

Topic 5: Mapping of EER Diagrams to Relations

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

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

Database Design Process

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

CS3200 Database Design Spring 2018 Derbinsky. Entity-Relationship (ER) Diagrams. Lecture 7

LECTURE 3: ENTITY-RELATIONSHIP MODELING

Translation ER/EER to relational

Database Management System (15ECSC208) UNIT I: Chapter 2: Relational Data Model and Relational Algebra

Conceptual Database Design

Chapter 6: Entity-Relationship Model

Intro to DB CHAPTER 6

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model

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

Definition. 02. Data Modeling. Example ABC Company Database. Data Modeling Importance

Chapter 7: Entity-Relationship Model

DATABASE DESIGN I - 1DL300

CS 338 The Enhanced Entity-Relationship (EER) Model


DATABASTEKNIK - 1DL116

DATA MODELING USING THE ENTITY-RELATIONSHIP MODEL. 1 Powered by POeT Solvers Limited

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Slide 4-1

Chapter 6: Entity-Relationship Model

Lecture3: Data Modeling Using the Entity-Relationship Model.

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

Chapter 9 Outline. Relational Database Design by ER and EERto-Relational. Mapping Fundamentals of Database Systems

MIT Database Management Systems Lesson 03: ER-to-Relational Mapping

Roadmap of This Lecture. Weak Entity Sets Extended E-R Features Reduction to Relation Schemas Database Design UML*

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

DATABASE DESIGN PROCESS

Relational Database Systems Part 01. Karine Reis Ferreira

High Level Database Models

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

Sahaj Computer Solutions. Data Modeling using the Entity Relationship Model

4. Entity Relationship Model

Lecture 10. Spring 2018 Borough of Manhattan Community College

Chapter 2 ENTITY RELATIONSHIP MODEL

Database Technology. Topic 4: Enhanced Entity- Relationship (EER) Modeling

CSE 530A. ER Model. Washington University Fall 2013

Chapter 7: Entity-Relationship Model

CMP-3440 Database Systems

Database Management System (15ECSC208) UNIT I: Chapter 1: Introduction to DBMS and ER-Model

Entity-Relationship Model

Entity-Relationship Model. Dr. Samaresh Mishra, School of Computer Engineering, KIIT University, Bhubaneswar

Lecture 10 - Chapter 7 Entity Relationship Model

This chapter discusses how to design a relational

Database Design Process. Requirements Collection & Analysis

Mapping ER Diagrams to. Relations (Cont d) Mapping ER Diagrams to. Exercise. Relations. Mapping ER Diagrams to Relations (Cont d) Exercise

COSC 304 Introduction to Database Systems. Entity-Relationship Modeling

CSE 880:Database Systems. ER Model and Relation Schemas

OVERVIEW OF DATABASE DEVELOPMENT

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

Transcription:

DATABASE DESIGN I - 1DL300 Fall 2009 An introductury course on database systems http://user.it.uu.se/~udbl/dbt1-ht2009/ alt. http://www.it.uu.se/edu/course/homepage/dbastekn/ht09/ Kjell Orsborn Uppsala Database Laboratory Department of Information Technology, Uppsala University, Uppsala, Sweden 11/12/09 1

Introduction to Database Design Using Entity-Relationship Modeling Elmasri/Navathe chs 3-4 Padron-McCarthy/Risch ch 2-3 Kjell Orsborn Department of Information Technology Uppsala University, Uppsala, Sweden 11/12/09 2

ER-modeling Aims at defining a high-level specification of the information content in the database. History Chen, P. P. S., The entity-relationship model: towards a unified view of data, ACM TODS, 1, 1 1976, p. 9-36. Why ER-models? High-level description - easier to understand for non-technicians More formal than natural language - avoid misconceptions and multiple interpretations Implementation independent (of DBMS) - less technical details Documentation Model transformation to an implementation data model 11/12/09 3

Entity type and entity An entity type represents a physical or abstract concept with some sort of identity. The individual instances of the concept are members of a set of entities that have the same set of attributes. Entity types express the intention, i.e. the meaning of the concept whereas the set of entities represents the extension of that type. Names of entity types are given in singular form. The description of an entity type is called its schema. PERSON name, ssn, address, phoneno Each attribute in an entity type is associated with a domain that indicates the allowed values of that attribute. 11/12/09 4

Attribute An attribute is a characteristic or aspect that describe an entity (and is defined on entity types). Every attribute has a domain (or value set). A domain specifies the set of allowed values each individual attribute can be assigned. There is (at least) six different types of values for attributes: simple/ sex: M or F composite name: (Ior, Karlsson) single-valued/ name: Ior Karlsson multivalued friends: {Nasse, Puh,...} stored/ birthdate: 980917 derived age : 0 null Note! ER-diagram Simple Composite Multivalued Derived 11/12/09 5

Attribute cont... Key: an attribute that has unique values for every instance of an entity type is called a key attribute. Sometimes several attributes are used together to get a unique key. An entity type can have more than one key. key hello 11/12/09 6

Relationship type and relationship A relationship type represents a relationship (or relation/connection), between a number of entity types. A relationship type R is a set of relationships (i.e. relational instances) or tuples. A relationship type, R, can mathematically be defined as: R E 1 E 2 E n where each Ej is a entity type. A tuple (or an instance) t R is written as (e 1, e 2,..., e n ) or <e 1, e 2,..., e n > where e j E j. 11/12/09 7

Structural constraints for relationship types Cardinality ratio constraint specifies the number of relational instances that an entity can take part in. For binary relationship types: one-to-one (1:1) one-to-many (1:N) many-to-many (M:N) 1 1 1 N M N 11/12/09 8

Structural constraints cont.... Partial Total Participation constraint specifies whether the entity existence is dependent of another entity via a relationship type. E.g. can an employee exist without working for a department? Partial participation: the entity can exist without this relationship Total participation: the entity requires this relationship in order to exist. employee works_for department manages 11/12/09 9

Roles of relationship types A role name specifies what role an entity type plays in a specific relationship Role names are sometimes used in ER-diagrams to clarify the roles of the participating entity types. Employee manager 1 N worker Supervision 11/12/09 10

Attributes for relationship types Also a relationship type can have attributes. E.g. in the case where the weekly number of hours an employee works on a project should be kept, that can be represented for each instance of the relation workson. If the relation is a 1:1 or 1:N relation, the attribute can be stored at one of the participating entities. When the relation is of the type M:N one must store the attributes with the instance of the relation. 11/12/09 11

Weak entity types Weak entity types are those that are meaningless without an owner entity type. Weak entities are uniquely identified in the extension with their owner s key attributes together with its own (broken) underlined attribute. The relationship to the owner is called the identifying relationship. 11/12/09 12

ER-notation (Elmasri/Navathe fig. 3.14) 11/12/09 13

ER model transformations Replacing multi-valued attributes by an entity type Dept id Name Location DEPARTMENT Dept id Name Location 1 N DEPARTMENT located at LOCATION 11/12/09 14

ER model transf. cont.... Replacing M-N relationships with an entity type and binary relationships. TEACHER TEACHER 1 lectures N N lectures booked for N N LECTURES Time ROOM N Time 1 ROOM N consists of COURSE 1 COURSE 11/12/09 15

Extended Entity-Relationship (EER) modeling The intention of using an E-R diagram is to use it as a basis for user communication or for getting to a good design specification. i.e. try to make it simple and avoid to much complexity. EER (extended or enhanced ER) introduces several notational extensions to deal concepts such as: Superclass /subclass (supertype/subtype, is-a relationship) specialization/generalization constraints Aggregation (whole/part or part-of relationship) Union types (category) 11/12/09 16

EER diagram notation for specialization and subclass (Elmasri/Navathe fig. 4.1) 11/12/09 17

Subclasses, superclasses & inheritance Two generic ideas for creating superclass/subclass relationships Specialization of superclass into subclasses Generalization of subclasses into a superclass Constraints and characteristics of spec. & gen. Constraints Predicate-defined (condition-defined) sub-classes Attribute-defined User-defined Disjointness Disjoint Overlapping Completeness Total Partial 11/12/09 18

Generalization of subclasses (Elmasri/Navathe fig. 4.3) 11/12/09 19

Overlapping (nondisjoint) subclasses (Elmasri/Navathe fig. 4.5) 11/12/09 20

Representation of aggregation in ER notation There is no explicit representation of aggregation in ER notation implicitely a relationsship type can represent an aggregation relationship e.g. a relationsship type that details are part of a product. PRODUCT 1 N part_of DETAIL objectifying the relationship type makes it explicit and referable. 1 N 1 1 PRODUCT consist ASSEMBLY part_in DETAIL 11/12/09 21

Union of two entity types (Elmasri/Navathe fig. 4.5a) 11/12/09 22

A UML conceptual schema (Elmasri/Navathe fig. 4.11) 11/12/09 23

Specialization/generalization in UML (Elmasri/Navathe fig. 4.12) 11/12/09 24

Alternative diagrammatic notation for ER/EER (Elmasri/Navathe fig. A.1) 11/12/09 25

Example ER-modeling An enterprise consists of a number of departments. Each department has a name, a number, a manager, and a number of employees. The starting date for every department manager should also be registered. A department can have several office rooms. Every department finances a number of projects. Each project has a name, a number and an office room. For each employee, the following information is kept: name, social security number, address, salary and sex. An employee works for only one department but can work with several projects that can be related to different departments. Information about the number of hours (per week) that an employee work with a project should be stored. Information about the employees manager should also be stored. 11/12/09 26