SE 4DB3 TUTORIAL 2: REDUCTION TO RELATIONAL SCHEMAS

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

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

ER to Relational Mapping

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

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

Intro to DB CHAPTER 6

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

Database Management

Topic 5: Mapping of EER Diagrams to Relations

Chapter 2: Entity-Relationship Model

ER-to-Relational Mapping

The Entity Relationship Model

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

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

Chapter 6: Entity-Relationship Model

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

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

Conceptual Data Modeling

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model

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

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

Chapter 7: Entity-Relationship Model

Chapter 6: Entity-Relationship Model

Lecture 10 - Chapter 7 Entity Relationship Model

Chapter 6: Entity-Relationship Model

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

More on the Chen Notation

ER to Relational Model. Professor Jessica Lin

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

The En'ty Rela'onship Model

CSIT5300: Advanced Database Systems

Database Management System 6 ER Modeling...

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

How to translate ER Model to Relational Model

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

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

Software Design. May 1, Version 6.1. CSC Advanced Topics in Software Engineering Spring 2014

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

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

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

DATABASE TECHNOLOGY - 1DL124

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

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 4 Entity Relationship (ER) Modeling

Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the Bank Database Reduction to

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 4 Entity Relationship (ER) Modeling

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

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

Translating an ER Diagram to a Relational Schema

SVY2001: Databases for GIS

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

MTAT Introduction to Databases

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

LELCTURE 4: ENHANCED ENTITY-RELATIONSHIP MODELING (EER)

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

Sahaj Computer Solutions. Data Modeling using the Entity Relationship Model

Database Management Systems LECTURE NOTES 2

DATABASE DESIGN I - 1DL300

A l Ain University Of Science and Technology

Unit1: Introduction. Database System Concepts, 6 th Ed. Silberschatz, Korth and Sudarshan See for conditions on re-use


OBJECTIVES. How to derive a set of relations from a conceptual data model. How to validate these relations using the technique of normalization.

Relational Model: History

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

CS 405G: Introduction to Database Systems

Relational Model and Relational Algebra. Rose-Hulman Institute of Technology Curt Clifton

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

Translation to Relational Schema

Chapter # 4 Entity Relationship (ER) Modeling

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

Entity-Relationship Model

CMP-3440 Database Systems

Chapter 6: Entity-Relationship Model

CS352 Lecture - The Entity-Relationship Model

Unit I. By Prof.Sushila Aghav MIT

Chapter 17. Methodology Logical Database Design for the Relational Model

Comp 5311 Database Management Systems. 2. Relational Model and Algebra

The Basic (Flat) Relational Model. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

CSIT5300: Advanced Database Systems

Lecture 14 of 42. E-R Diagrams, UML Notes: PS3 Notes, E-R Design. Thursday, 15 Feb 2007

A l Ain University Of Science and Technology

Transforming ER to Relational Schema

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

Chapter (4) Enhanced Entity-Relationship and Object Modeling

Entity Relationship Data Model. Slides by: Shree Jaswal

Conceptual Modeling in ER and UML

Review -Chapter 4. Review -Chapter 5

Entity Relationship Modeling. From Rob and Coronel (2004), Database Systems: Design, Implementation, and Management

Relational Database Systems Part 01. Karine Reis Ferreira

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

Chapter 4. In this chapter, you will learn:

EECS 647: Introduction to Database Systems

Guideline 1: Semantic of the relation attributes Do not mix attributes from distinct real world. example

David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation

Handout 4. Logical Database Modeling, Part 1: Relational Data Model. Transforming EER model to Relational.

COMP Instructor: Dimitris Papadias WWW page:

A Deeper Look at Data Modeling. Shan-Hung Wu & DataLab CS, NTHU

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

High-Level Database Models (ii)

Transcription:

SE 4DB3 TUTORIAL 2: REDUCTION TO RELATIONAL SCHEMAS Jan 29, 2016

Sample ER diagram date

Representing of Strong Entity Sets Let E be a strong entity set with descriptive attributes a 1, a 2,, a n. We represent this entity by a schema called E with n distinct attributes. The primary key of the entity set serves as the primary key of the resulting schema. USER(userid, name, email) PK=userid

Representation of Weak Entity Sets Let A be a weak entity set with attributes a 1, a 2,, a m. Let B be the strong entity set on which A depends. Let the primary key of B consist of attributes b 1, b 2,, b n. We represent the entity set A by a relation schema called A with one attribute for each member of the set: {a 1, a 2,, a m } U {b 1, b 2,, b n } The combination of the primary key of the strong entity set and the discriminator of the weak entity set serves as the primary key of the schema.

Representation of Weak Entity Sets PATCH(projectid, patchid, name, status, description, type) PK=(projectid, patchid) FK(PROJECT)=property_id

Representation of Relationship Sets A many-to-many relationship set is represented as a schema with attributes for the primary keys of the two participating entity sets, and any descriptive attributes of the relationship set. Schemas derived from entity sets: PROJECT ( ) USER( ) Schema derived from relationship sets: DOWNLOAD(projectid, userid, date) PK=(projectid, userid, date) NOTE: same user may download same project on different dates. FK(PROJECT)=property_id FK(USER)=userid

Redundancy of Schemas Many-to-one and one-to-many relationship sets that are total on the many-side can be represented by adding an extra attribute to the many side, containing the primary key of the one side. Schemas derived from entity sets: SUBSCRIBER(..) BUG(projectid, date, bugid, description, userid) NOTE: projectid and date because of weak entity set; userid because of many-to-one relationship. PK=(projectid, bugid) FK(PROJECT)=property_id FK(USER)=userid No schema derived from relationship set Correction of PK

Redundancy of Schemas We can combine schemas even if the participation is partial, by using null values. i.e. we could store null values for the userid attribute for BUG that have no associated SUBSCRIBER. For one-to-one relationship sets, either side can be chosen to act as the many side. That is, extra attribute can be added to either of the tables corresponding to the two entity sets.

Composite Attributes We handle composite attributes by creating a separate attribute for each of the component attributes; we do not create a separate attribute for the composite attribute itself. Suppose that Name=last name + middle name + first name USER(userid, last name, middle name, first name, email) PK=userid

Multivalued Attributes For a multivalued attribute M, we create a relation schema R with an attribute A that corresponds to M and attributes corresponding to the primary key of the entity set or relationship set of which M is an attribute. PROJECT(projectid, status, description) PK=projectid CATEGORY(projectid, categories) PK=(projectid, categories) FK(PROJECT)=projectid Correction of PK for CATEGORY

Representation of Specialization Method 1: Form a schema for the higher-level entity Form a schema for each lower-level entity set, include primary key of higher-level entity set and local attributes. USER(userid, email, name) PK=userid GUEST(userid) PK=userid FK(USER)=userid SUBSCRIBER(userid, subscrdate, password) PK=userid FK(USER)=userid

Representation of Specialization Method 2: If specialization is disjoint and complete Form a schema for entity set with all local and inherited attributes. TRANSACTION(projectid, date,transactid) PK=(projectid, transactid) FK(PROJECT)=projectid DEVELTRANS(projectid, date, transactid) PK=(projectid, transactid) FK(TRANSACTION)=(projectid, transactid) UPDATETRANS(projectid, date, transactid) PK=(projectid, transactid) FK(TRANSACTION)=(projectid, transactid) Correction: Add TRANSCATION because FK constraint; correct FK for lower-level entity.