SVY2001: Databases for GIS

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

ER to Relational Mapping

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

Database Management

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

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

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

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

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

SVY227: Databases for GIS

Topic 5: Mapping of EER Diagrams to Relations

ER-to-Relational Mapping

LELCTURE 4: ENHANCED ENTITY-RELATIONSHIP MODELING (EER)

COIS Databases

Chapter 8 The Enhanced Entity- Relationship (EER) Model

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

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

Enhanced Entity-Relationship (EER) Modeling

Chapter (4) Enhanced Entity-Relationship and Object Modeling

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

This chapter discusses how to design a relational

Relational Model: History

Translation ER/EER to relational

Enhanced Entity- Relationship Models (EER)

CMP-3440 Database Systems

Entity Relationship Data Model. Slides by: Shree Jaswal

Chapter 2: Entity-Relationship Model

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

Advance Database Management System

Course Notes on From Entity-Relationship Schemas to Relational Schemas

DATABASE DESIGN I - 1DL300

DATABASE DESIGN I - 1DL300

Chapter 8: Enhanced ER Model

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

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 8 Data Modeling Advanced Concepts

6.1 RELATIONSHIP CONCEPTS

Database Design Process

SE 4DB3 TUTORIAL 2: REDUCTION TO RELATIONAL SCHEMAS

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

Chapter 6. Advanced Data Modeling. Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

Chapter 2 ENTITY RELATIONSHIP MODEL

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

DATABASDESIGN FÖR INGENJÖRER F

Relational Database Systems Part 01. Karine Reis Ferreira

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called

COMP102: Introduction to Databases, 13

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model

Database Design Process. Requirements Collection & Analysis

Chapter 7: Entity-Relationship Model

Chapter 6: Entity-Relationship Model

The Enhanced Entity Relationship (EER) Model

Chapter 7: Entity-Relationship Model. Chapter 7: Entity-Relationship Model

Chapter 6: Entity-Relationship Model

Advanced Databases (SE487) Prince Sultan University College of Computer and Information Sciences

Fundamentals of. Database Systems. Shamkant B. Navathe. College of Computing Georgia Institute of Technology PEARSON.

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

Let s briefly review important EER inheritance concepts

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

DATABASTEKNIK - 1DL116

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

Conceptual and Logical Design

Unit 2. Unit 3. Unit 4

Chapter 17. Methodology Logical Database Design for the Relational Model

Conceptual Data Models for Database Design

Database Management System 6 ER Modeling...

Chapter 3 The Enhanced E-R Model

Relational Model. CS 377: Database Systems

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

A Translation of the One-to-One Relationship for Introductory. Relational Database Courses

CS 338 The Enhanced Entity-Relationship (EER) Model

Notes. These slides are based on a slide set provided by Prof. M. Tamer Öszu. CS 640 E-R Model Winter / 23. Notes

4. Entity Relationship Model

Essentials of Database Management

Conceptual Database Design

CSE 880:Database Systems. ER Model and Relation Schemas

Database Design. Database Design I: The Entity-Relationship Model. Entity Type (con t) Representation in Relational Model.

Database Design and the E-R Model (7.4, )

Data Modeling Using the Entity-Relationship (ER) Model

Informatics 1: Data & Analysis

Conceptual Database Design (ER modeling) Chapter Three

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

How to translate ER Model to Relational Model

Lecture 10 - 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

Entity Relationship Modelling

SVY2001: Databases for GIS

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

Administrivia. Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Course Topics. Problem

Informatics 1: Data & Analysis

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


Problem. Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications

Translation to Relational Schema

Chapter 6: Entity-Relationship Model

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

The Entity-Relationship Model

Informatics 1: Data & Analysis

Data Analysis 2. Chapter 2.2 V3.0. Napier University Dr Gordon Russell

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

Transcription:

SVY200: Databases for GIS Lecture 0: From ER & EER odels to Relation Scheme. Dr Stuart Barr School of Civil Engineering & Geosciences University of Newcastle upon Tyne. Email: S.L.Barr@ncl.ac.uk Lecture 0: ER & EER to Relation Scheme

Lecture Objectives & Contents Objectives: To consider how to transform ER and EER models to relation scheme and mappings. Contents: ER model to relation scheme. EER model to relation scheme considerations. Summary Lecture 0: ER & EER to Relation Scheme 2

E/R to Relation Scheme & apping How do we move from this to relation scheme? SattfID Address Sex Hours Income Work_On N Project Controls anages Work_For Department StDate DeptID Lecture 0: ER & EER to Relation Scheme 3

apping Regular Entity Sets ake regular (normal) entity sets in an ER model a simple relation in the relational scheme. Include all normal attributes & choose an entity key to be the primary key. ID Address Sex ID Address Sex Lecture 0: ER & EER to Relation Scheme 4

apping Weak Entity Sets Create a relation for the weak entity set. Its foreign key = the primary key of the identifying entity set. Its primary key = partial key + primary key of identifying entity set. DoB Relation ID Dependent DependentOf Dependent ID DoB Relation Lecture 0: ER & EER to Relation Scheme 5

Binary One-to-One Relationships ake sure that the two entity sets have been mapped to relations. The preferred approach is then to cerate an explicit One-to-One relationship on the basis of the primary and foreign key concept. Can also merge a relations or create a relationship relation. ID Address Sex DeptID anages Department ID Address Sex Department DeptID anagerid Lecture 0: ER & EER to Relation Scheme 6

Binary One-to-any Relationships Find the any entity-set (relation) of the relationship. Include in this relation as a foreign key the primary key of other entity set (relation) in the relationship. An alternative again is the relationship relation. ID Address Sex DeptID WorkFor Department ID Address DeptID Sex Department DeptID anagerid Lecture 0: ER & EER to Relation Scheme 7

Binary any-to-any Relationships Needs a new relation that acts as a lookup - so must have a relationship relation. The foreign keys are the primary keys of the two participating entity sets (relations). The primary key of the relationship relation is both foreign keys. ID Address Sex Income Work_On N Project ID Address Sex Proj ID Proj Project Income Lecture 0: ER & EER to Relation Scheme 8

N-ary Relationships Create a new relation to represent the N-ary relationship. Foreign keys are the primary keys of the defining relations. Its primary key is the combination of primary keys of the relations. ID Address Sex Cost Prefer N Instruments Income Project ID Address Sex Instrument cost ProjIns ID Instru Proj Project Income Lecture 0: ER & EER to Relation Scheme 9

ultivalued Attributes Will violate first-normal form. Create a new relation whose for foreign key is the primary key of the entity set. The primary key of the new relation is foreign key and the attribute name given to the multivalued attribute. The relationship between the two relations is a One-to-any. Number Locations Department Department Number Dept_Locations Number Location Lecture 0: ER & EER to Relation Scheme 0

Relationship Attributes: any-to-any They simply form an attribute of the relationship relation that is created. SattfID Address Sex Hours Income Work_On N Project ID Address Sex Proj ID Proj Hours Project Income Lecture 0: ER & EER to Relation Scheme

Relationship Attributes: One-to-One & One-to-any Best managed by incorporating into one of the base relations. Choose the relation where the attribute will not have a null item. ID Address Sex DeptID StDate anages Department ID Address Sex Department DeptID anagerid anagerstdate Lecture 0: ER & EER to Relation Scheme 2

EER odel apping option ultiple relations for superclass & subclass. Works for any specialisation (total/partial & disjoint/overlap). ID Address Sex Qualification TypeSpeed Surveyor Technician Secretary Instrument ID Address Sex Secretary ID Qualification Technician ID Qualification Surveyor ID Qualification Lecture 0: ER & EER to Relation Scheme 3

EER odel apping option 2 ultiple relations for subclasses. Only for subclasses that give total specialisation. Reg Price Vehicle NPassengers Speed Car Truck Tonnage Nwheels Car Reg Price NPassengers speed Truck Reg Price Tonnage Nwheels Lecture 0: ER & EER to Relation Scheme 4

EER odel apping option 3 Single relation with a distinctive (discriminating) type attribute. Works only for subclasses that are disjoint. Null values and large degree tuples potential problem. ID Address Sex Qualification TypeSpeed Surveyor Technician Secretary Instrument ID Address JobType Qualification TypeSpeed Instrument Sex Lecture 0: ER & EER to Relation Scheme 5

EER odel apping option 4 Single relation with Boolean flags to recognise subclass type. Works for specialisation that have overlapping subclasses. Again potential for large number of nulls and large tuple degree. ID Address Sex Project O odules Researcher Lecturer ID Address Sex RFlag Project Lflag odule ID oduleid odule oduleid Lecture 0: ER & EER to Relation Scheme 6

EER odel apping: ultiple Inheritance Can be handled using all the previous options. Choice depends on trade off between excessive relations Vs large tuples with lost of nulls. Surveyor anager Survey_anager ID. Surveyor ID anager ID Survey_anager ID Lecture 0: ER & EER to Relation Scheme 7

EER odel apping: Union Types Superclasses have different keys neither can identify the union. Specify a new key attribute called a surrogate key to build relationship with union class. Company U Person Users Subscribe Company CID UserID. Person NI UserID. Users UserID Subscribe UserID agid Lecture 0: ER & EER to Relation Scheme 8

Lecture 0: Reading Elmasri, R., and Navathe, S., 2003. Fundamentals of Database Systems. Addison Wesley (London). Pages 9-205. Lecture 0: ER & EER to Relation Scheme 9