A short review on entity- relationship modelling.

Slides:



Advertisements
Similar presentations
ER to Relational Mapping. Logical DB Design: ER to Relational Entity sets to tables. CREATE TABLE Employees (ssn CHAR (11), name CHAR (20), lot INTEGER,
Advertisements

Logical DB Design: ER to Relational Entity sets to tables. Employees ssn name lot CREATE TABLE Employees (ssn CHAR (11), name CHAR (20), lot INTEGER, PRIMARY.
The Entity-Relationship Model
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
The Entity-Relationship Model
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Book Chapter 3 (part 2 ) From ER to Relational Model.
1 541: Database Systems S. Muthu Muthukrishnan. 2 Overview of Database Design  Conceptual design: (ER Model is used at this stage.)  What are the entities.
1 Key Constraints Consider Works_In: An employee can work in many departments; a dept can have many employees. In contrast, each dept has at most one manager,
The Entity-Relationship (ER) Model
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
The Entity-Relationship Model
Comp3300/fall021 The Entity-Relationship Model Chapter 2 What are the steps in designing a database ? Why is the ER model used to create an initial design?
The Entity-Relationship Model
The Entity-Relationship Model Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY courtesy of Joe Hellerstein for some slides.
Conceptual Design and The Entity-Relationship Model
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 176 Database Systems I The Entity-Relationship Model.
1 The Entity-Relationship Model Chapter 2. 2 Overview of Database Design  Conceptual design: (ER Model is used at this stage.) –What are the entities.
Modeling Your Data Chapter 2. Overview of Database Design Conceptual design: –What are the entities and relationships in the enterprise? – What information.
Conceptual Design Using the Entity-Relationship (ER) Model
The Entity- Relationship Model CS 186 Fall 2002: Lecture 2 R &G - Chapter 2 A relationship, I think, is like a shark, you know? It has to constantly move.
Lecture 2: Entity/Relationship modelling
The Entity-Relationship (ER) Model CS541 Computer Science Department Rutgers University.
1 Data Modeling Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
ER continued, and ER to Relational Mappings R&G Chapters 2, 3 Lecture 22.
1 The Entity-Relationship Model Chapter 2. 2 Database Design Process  Requirement collection and analysis  DB requirements and functional requirements.
The Entity-Relationship Model. 421B: Database Systems - ER Model 2 Overview of Database Design q Conceptual Design -- A first model of the real world.
1 The Entity-Relationship Model Chapter 2. 2 Overview of Database Design  Conceptual design : (ER Model is used at this stage.)  What are the entities.
ER to Relational Mapping. Logical DB Design: ER to Relational Entity sets to tables. CREATE TABLE Employees (ssn CHAR (11), name CHAR (20), lot INTEGER,
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Chapter 2.  Conceptual design: (ER Model is used at this stage.) ◦ What are the entities and relationships in the enterprise? ◦ What information about.
CMPT 258 Database Systems The Entity-Relationship Model Part II (Chapter 2)
Christoph F. Eick: Designing E/R Diagrams 1 The Entity-Relationship Model Chapter 3+4.
LECTURE 1: Entity Relationship MODEL. Think before doing it! Like most of the software projects, you need to think before you do something. Before developing.
09/03/2009Lipyeow Lim -- University of Hawaii at Manoa 1 ICS 321 Fall 2009 Introduction to Database Design Asst. Prof. Lipyeow Lim Information & Computer.
Mapping E/R Diagrams to Relational Database Schemas
Lecture 3 Book Chapter 3 (part 2 ) From ER to Relational.
The Entity-Relationship (ER) Model. Overview of db design Requirement analysis – Data to be stored – Applications to be built – Operations (most frequent)
CSC 411/511: DBMS Design 1 1 Dr. Nan WangCSC411_L2_ER Model 1 The Entity-Relationship Model (Chapter 2)
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.
LECTURE 1: Entity Relationship MODEL. Think before doing it! Like most of the software projects, you need to think before you do something. Before developing.
Lecture 3 A short revision of ER and EER modelling See R. Elmasri, S.B. Navathe. Fundamentals of Database Systems (third edition) Addison-wesley. Chapter.
A short revision on entity- relationship modelling.
1 Introduction to Data Management Lecture #3 (Conceptual DB Design) Instructor: Chen Li.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
COP Introduction to Database Structures
MODELS OF DATABASE AND DATABASE DESIGN
ER-to-Relational Mapping
The Entity-Relationship Model
Instructor: Elke Rundensteiner
DATABASE MANAGEMENT SYSTEMS
From ER to Relational Model
The Entity-Relationship (ER) Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
Question Which of the following plays an important role in representing information about the real world in a database? Explain briefly 1)DDL.
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship Model
The Entity-Relationship (ER) Model
Presentation transcript:

A short review on entity- relationship modelling

Entity/Relationship Models An Entity/Relationship model consists of diagrams to represent designs. Entity like object = ”thing.” Entity sets like class = set of ”similar” entities/objects. Attribute = property of entities in an entity set. Relationships connect different entity type.

Entity/Relationship Models In diagrams: entity sets are rectangles; attributes are oval; relationship sets are diamonds.

Multiway Relationships Usually relationships are binary. That is they connect two entity types. However, there are some cases where three or more entity types must be connected by one relationship. These relationships are called multiway relationships.

Roles A recursive relationship is a relation type where the same entity participates more than one in different roles. We label each edge with the role name.

An Example

Multiplicity of relationships Many to Many relation: Bars serve different beers Many to One relation: Drinkers have favorite beers One to One relation: Breweries have only one best seller

Total participation If all the elements of the entity type E are related to some element of an entity type F via a relationship R, then the participation of E in R is called total participation. Example: breweries must have one best seller beer.

Keys A key is a set of attributes such that no two entities agree on all these attributes. In E/R model every entity type must have a designated key. In E/R diagrams you should underline all attributes of the key.

Weak entities Entity sets that do not have key attributes of their own are called weak entity types. The remaining attributes come from another (or more) entity type which is related to the weak entity set by an identifying (1 to M) relationship. The weak entity set must have total participation in the identifying relationship. IN E/R diagrams you should represent weak entity sets as double rectangles represent identifying relationships as double diamonds Partial key

ISA (`is a’) Hierarchies Contract_Emps name ssn Employees lot hourly_wages ISA Hourly_Emps contractid hours_worked  As in C++, or other PLs, attributes are inherited.  If we declare A ISA B, every A entity is also considered to be a B entity. Overlap constraints: Can Joe be an Hourly_Emps as well as a Contract_Emps entity? (Allowed/disallowed) Covering constraints: Does every Employees entity also have to be an Hourly_Emps or a Contract_Emps entity? (Yes/no) Reasons for using ISA : – To add descriptive attributes specific to a subclass. – To identify entitities that participate in a relationship.

Aggregation Used when we have to model a relationship involving (entitity sets and) a relationship set. – Aggregation allows us to treat a relationship set as an entity set for purposes of participation in (other) relationships. * Aggregation vs. ternary relationship :  Monitors is a distinct relationship, with a descriptive attribute.  Also, can say that each sponsorship is monitored by at most one employee. budget did pid started_on pbudget dname until Departments Projects Sponsors Employees Monitors lot name ssn since

Exercise Suppose you are hired to develop a geographical information system. Your task is to develop its databases, with the following information: A continent has a name and contains different countries (e.g., Europe). Each country resides only in one continent. Each country has a name, a population value, official language(s), and its capital city. Each official language may be shared by different countries (e.g.English). Each language has a unique ID (LangID) and a name. Each city carries a name and a population value. Each city resides only in one country. The name of each city is unique within its country. Each river has a unique ID (RiverID), a name, and its length. Rivers run through one or more countries. International treaties are identified by their names. They also contain their subjects as well as starting dates. Each treaty consists of at least two countries. 1.Design and draw an E/R diagram that captures the above information. Be careful to indicate any key and participation constraints (multiplicity constraints). 2.Convert the E/R diagram to a relational database schema.

Exercise A continent has a name and contains different countries (e.g., Europe). Each country resides only in one continent. Each country has a name, a population value, official language(s), and its capital city. Each official language may be shared by different countries (e.g.English). Each language has a unique ID (LangID) and a name. Each city carries a name and a population value. Each city resides only in one country. The name of each city is unique within its country. Each river has a unique ID (RiverID), a name, and its length. Rivers run through one or more countries. International treaties are identified by their names. They also contain their subjects as well as starting dates. Each treaty consists of at least two countries.

Solution

Solution (Cont.)