Extended ER Mappings & Models. General Principle #1 Graphical representations dictate cardinality relationships among attributes. When graphical representations.

Slides:



Advertisements
Similar presentations
The transformation of an ER or EER model into a relational model
Advertisements

Convert ER to Relational Database Entity relation Entity relation Attributes attributes Attributes attributes Primary key primary key Primary key primary.
Chapter 6: Entity-Relationship Model (part I)
Database Design The process of finding user requirement
1 Design Process - Where are we? Conceptual Design Conceptual Schema (ER Model) Logical Design Logical Schema (Relational Model) Step 1: ER-to-Relational.
Relational Database Design Via ER Modelling
1 Entity-Relationship Modeling. 2 ER Graphical modeling technique Informal, understandable for laymen Coarse technique to design tables Provides rules.
Relational Database. Relational database: a set of relations Relation: made up of 2 parts: − Schema : specifies the name of relations, plus name and type.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Database Processing: Fundamentals, Design, and Implementation, 9/e by David M. KroenkeChapter 5/1 Copyright © 2004 Please……. No Food Or Drink in the class.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
Database Systems: Design, Implementation, and Management Tenth Edition
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 6 Advanced Data Modeling.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 6 Advanced Data Modeling.
Chapter 4 Conceptual Modeling of Databases with Entity-Relationship Diagrams and the Unified Modeling Language.
NestedRelations: 1 Nested Relations Flat schemas often have replicated data values in their relations. Nested schemas allow us to collapse some of these.
Translating from ER to Relationship Schema Adapted from Juliana Freire.
XNF: 1 XML and NNF A Standard Form for XML Documents (XNF) Properties –As few hierarchical trees as possible –No redundant data values in any tree Method.
Chapter Abstraction Concrete: directly executable/storable Abstract: not directly executable/storable –automatic translation (as good as executable/storable)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Fundamentals, Design, and Implementation, 9/e Chapter 5 Database Design.
Mappings & Normal Form Guarantees. Can Mappings of Diagrams Yield Normalized Schemas? “Yes”—but only if canonical. Most (?) diagrams are canonical. Mappings.
OSM—Normalize Then Map. ER Model Instance Type  RackRate Room Date  Guest Rate Discount Date  Discount Rate = (1 – Discount/100)  RackRate includes.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 5 Understanding Entity Relationship Diagrams.
OSM & Allegro. OSM Object-oriented Systems Modeling Components: –Object Relationship Model Object sets—lexical and non-lexical Relationship sets Generalization/specialization.
Create, Insert, Delete, Update. Create Create database Create table Create index – Primary – Secondary.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
CostAnalysis: 1 Cost Analysis Rule-of-Thumb Guidelines As a guide, consider denormalizing if: –redundancy is minimal and update anomalies are not expected.
Chapter Implementation Faithful translation of a design into a target environment Design should be free of target-environment dependencies Should.
Chapter 4 Entity Relationship (E-R) Modeling
Design Algorithm Essentials 1.Combine functional edges with the same tail object set(s) into a scheme. (The tail object set(s) and any others in a 1-1.
The OOA Process - I Steps and Rules Objects and Structures.
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
Data Modeling Using the Entity-Relationship Model
Chapter 91 ER & EER to Relational Mapping. Chapter 92 ER to Relational Mapping Step 1: For each regular entity type E in the ER schema, create a relation.
ER- and EER-to-Relational Mapping
Data Modeling Using the Entity-Relationship Model
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Entities and Attributes
Conceptual Modeling with ER Diagrams Peter Chen introduced ER Diagrams.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 2/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Chapter 8 Data Modeling Advanced Concepts Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 4 Mapping an ER model to tables © Akhilesh Bajaj,
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
1 A Demo of Logical Database Design. 2 Aim of the demo To develop an understanding of the logical view of data and the importance of the relational model.
 Primary keys allow entity sets and relationship sets to be expressed uniformly as relations  E/R diagram  collection of tables  For each entity set.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Databases Illuminated Chapter 3 The Entity Relationship Model.
DatabaseIM ISU1 Chapter 7 ER- and EER-to-Relational Mapping Fundamentals of Database Systems.
Lecture 03 Entity-Relationship Diagram. Chapter Outline.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Chapter 4 Extended Entity-Relationship (EER)Model Incorporates Set-subset Relationships Incorporates Generalization Hierarchies Constraints: Coverage Constraints:
Entity-Relationship Modeling. 2 Entity Type u Entity type –Group of objects with same properties, identified by enterprise as having an independent existence.
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
Mapping E/R to RM, R. Ramakrishnan and J. Gehrke with Dr. Eick’s additions 1 Mapping E/R Diagrams to Relational Database Schemas Second Half of Chapter.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Module 8: Entity-Relationship.
Database Design, Application Development, and Administration, 6 th Edition Copyright © 2015 by Michael V. Mannino. All rights reserved. Chapter 5 Understanding.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Data Modeling Using the Entity- Relationship (ER) Model
COP Introduction to Database Structures
Entity-Relationship Model
Relational Database Design by ER- and EER-to- Relational Mapping
Entity-Relationship Model
Database Management system
Presentation transcript:

Extended ER Mappings & Models

General Principle #1 Graphical representations dictate cardinality relationships among attributes. When graphical representations are insufficient, add missing cardinality relationships formally or with notes.

General Principle #2 Observe cardinality constraints Find keys and directly-dependent attributes –Keys 1-1 relationships Can be composite –Directly-dependent attributes n-1 relationships those that depend on the key, the whole key, and nothing but the key

General Principle #3: Mapping 1.Group any mutually dependent keys. 2.Designate a primary key for each group. 3.To each group, add: directly dependent non-key attributes, and directly dependent primary key attributes. 4.Name the group of attributes and form a relational schema.

Basic ER Mappings Room RoomNr Type occupies Guest is signed up for Activity GuestNr AddressName Description Duration ExtraChargesTime Rate Date RoomName

Activity(Description, Duration) Guest(GuestNr, Name, Address) Room(RoomNr, RoomName, Type, Rate, GuestNr, ExtraCharges) IsSignedUpFor(GuestNr, Description, Date, Time) Room RoomNr Type occupies Guest is signed up for Activity GuestNr AddressName Description Duration ExtraChargesTime Rate Date RoomName Notes: 1.GuestNr-Description is the default key for many-many relationships. 2.Having GuestNr-Description as the key corresponds to the policy that a guest can sign up for an activity only once. 3.Having GuestNr-Date-Time as the key corresponds to the policy that a guest can sign up for only one activity at a particular time. 4.Having Description-Date-Time as the key corresponds to the policy that only one guest can sign up for an activity at a particular time.

Complex Key Attributes Room RoomNr Rate has reservation for Guest is signed up for Activity AddressName Description Duration Date NrInParty DateTime Name Address  Guest RoomNr Date  Name Address Rate Name Address Date Time  Descripti on NrInParty City

Room(RoomNr) Guest(Name, Address, City) Activity(Description, Duration) HasReservationFor(RoomNr, Date, Name, Address, Rate) IsSignedUpFor(Name, Address, Date, Time, Description, NrInParty) Room RoomNr Rate has reservation for Guest is signed up for Activity AddressName Description Duration Date NrInParty DateTime Name Address  Guest RoomNr Date  Name Address Rate Name Address Date Time  Descripti on NrInParty City

Recursive Relationship Sets & Roles Connecting Room RoomNr Type is connected with

Connecting Room RoomNr Type is connected with Room(RoomNr, Type) IsConnectedWith(RoomNr, ConnectingRoomNr)

Weak Entity Sets is for Room RoomNr Type Guest Activity GuestNr NrPersons Name Description Duration BedAndBreakfast is for Reservation Name Location YearOpened GuaranteeNr DateTimeAge Person Activity Registration Name Location  BedAndBreakfast Name Location RoomNr  Room GuestNr Name  Person GuestNr Name Date Time  ActivityRegistration

is for Room RoomNr Type Guest Activity GuestNr NrPersons Name Description Duration BedAndBreakfast is for Reservation Name Location YearOpened GuaranteeNr DateTimeAge Person Activity Registration Name Location  BedAndBreakfast Name Location RoomNr  Room GuestNr Name  Person GuestNr Name Date Time  ActivityRegistration BedAndBreakfast(Name, Location, YearOpened) Room(Name, Location, RoomNr, Type) Reservation(GuaranteeNr, Name, Location, RoomNr, GuestNr) Guest(GuestNr, NrPersons) Person(GuestNr, Name, Age) Activity(Description, Duration) ActivityRegistration(GuestNr, Name, Date, Time, Description)

ISA Hierarchies   Room RoomNr Rate has reservation for Guest is signed up for Activity NameDescriptionDuration Date RoomNr Date  GuestNr Rate Current Guest Future Guest HighCost Activity Single Double Suite    GuestNr Free Activity Returning Guest CreditCardNr CreditCard Expiration ExtraChargesNrOfReservations Discount Cost DownPayment Advance Reservation Requirement Equipment Deposit Notification Requirement

General Principle #4: ISA Choose to make relational schemas for: –All entity sets –Only root entity sets With a new attribute for each specialization (if applicable) With one new attribute for all specialization (if applicable) –Only leaf entity sets Rule-of-thumb guidelines –Leaf: partition, and leaves have (many) attributes –All: specialization entity sets have many attributes –Root: specialization entity sets have few attributes (add new attributes to designate specializations)

  Room RoomNr Rate has reservation for Guest is signed up for Activity NameDescriptionDuration Date RoomNr Date  GuestNr Rate Current Guest Future Guest HighCost Activity Single Double Suite    GuestNr Free Activity Returning Guest CreditCardNr CreditCard Expiration ExtraChargesNrOfReservations Discount Cost DownPayment Advance Reservation Requirement Equipment Deposit Notification Requirement Room(RoomNr, RoomType) Guest(GuestNr, Name, ExtraCharges?, CreditCardNr?, CreditCardExpiration?, NrOfReservations?, Discount?) Activity(Description, Duration) HighCostActivity(Description, Cost, DownPayment, AdvanceReservationRequirement) FreeActivity(Description, EquipmentDeposit, NotificationRequirement) HasReservationFor(RoomNr, Date, GuestNr, Rate) IsSignedUpFor(GuestNr, Description} Could also add Boolean attributes: CurrentGuest, FutureGuest, and ReturningGuest

Mappings for Complex Attributes Room RoomNr Guest AddressName ActivityInterest NameAndAddress StreetNr Rate City StateOrCountry PostalCode Discount has reservation for Date RackRateView Currency RoomNr Date  Guest (Date RoomNr).Rate = (1 – GuestNr.Discount/100)  Room.RackRate Currency.FCAmount = (1 + Fee/100)  [Amount]  Currency.ExchangeRate FCAmount Fee Foreign Currency Rate Exchange Rate GuestNr View: Ocean, Mountain, CityOverlook

Room RoomNr Guest AddressName ActivityInterest NameAndAddress StreetNr Rate City StateOrCountry PostalCode Discount has reservation for Date RackRateView Currency RoomNr Date  Guest (Date RoomNr).Rate = (1 – GuestNr.Discount/100)  Room.RackRate Currency.FCAmount = (1 + Fee/100)  [Amount]  Currency.ExchangeRate FCAmount Fee Foreign Currency Rate Exchange Rate GuestNr View: Ocean, Mountain, CityOverlook Guest(GuestNr, Name, StreetNr, City, StateOrCountry, PostalCode, Discount) GuestActivityInterest(GuestNr, ActivityInterest) Room(RoomNr, RackRate, Ocean, Mountain, CityOverlook) HasReservationFor(RoomNr, Date, GuestNr, Rate) ForeignCurrencyRate(Currency, ExchangeRate) Fee(Fee)

Mandatory/Optional Participation has favorite Room RoomNr Type occupies Guest GuestNr AddressName Rate has reservation for Date RoomNr Date  Guest

has favorite Room RoomNr Type occupies Guest GuestNr AddressName Rate has reservation for Date RoomNr Date  Guest RoomAndOccupant(RoomNr, Type, GuestNr?) GuestAndFavoriteRoom(GuestNr, Name, Address?, RoomNr?) HasReservationFor(RoomNr, Date, GuestNr, Rate)

General Principle #5: Nulls Primary-key attributes are not nullable. Mandatory/Optional participation determines nullability (even when not specified in the conceptual-model instance).

UML 1 2..* 1..* * * * * * * * * {incomplete, disjoint} connecting Room BedAndBreakfast name location yearOpened Reservation rate = calcRate( ) calcRate( ) DateDiscount date discount MailingAddress name streetNr city stateOrCountry postalCode Room roomNr type rackRate FavoriteRoom Activity description duration Guest guestNr nameAndAddress: MailingAddress nrPersons activityInterest [0..*] Activity Registration date time Person name age [0..1] HighCost Activity Free Activity

1 2..* 1..* * * * * * * * * {incomplete, disjoint} connecting Room BedAndBreakfast name location yearOpened Reservation rate = calcRate( ) calcRate( ) DateDiscount date discount MailingAddress name streetNr city stateOrCountry postalCode Room roomNr type rackRate FavoriteRoom Activity description duration Guest guestNr nameAndAddress: MailingAddress nrPersons activityInterest [0..*] Activity Registration date time Person name age [0..1] HighCost Activity Free Activity Guest(guestNr, name, streetNr, city, stateOrCountry, postalCode, nrPersons) ConnectingRoom(roomNr, name, location, connectingRoomNr) GuestActivityInterest(guestNr, activityInterest) Reservation(roomNr, name, location, date, guestNr, rate) Activity(description, duration, costLevel?) ActivityRegistration(name, guestNr, date, time, description) BedAndBreakfast(name, location, yearOpened) Room(roomNr, name, location, type, rackRate) FavoriteRoom(roomNr, name, location, guestNr) DateDiscount(date, discount) Person(name, guestNr, age?)