Home Page

Title Page

The Entity Relationship Model • The building blocks of an Entity-Relationship Diagram (ERD) • Cyclic relationships
Page 1 of 43

• Weak entity types • An informal algorithm for constructing an ERD

Go Back

Full Screen

Close

Quit

Home Page

Title Page

The Components of the ER Model [Che76] • Data structures ⇒ entities and relationships. • Integrity constraints ⇒ primary keys for entities and relationships, and ⇒ cardinality constraints for relationships. • The ER model is only a partial data model, since it has no standard manipulative part.

Page 2 of 43

Go Back

Full Screen

Close

Quit

Example Entity Relationship Diagram
NAME
Home Page

PHONES ADDRESS

C#

Title Page

CUSTOMER QTY PLACES RECEIVES

O#
Page 3 of 43

ORDER

BILLING

INVOICE

Go Back

O-DATE

SPECIFIES

I#

I-DATE

VALUE

Full Screen

BOOK ISBN

Close

TITLE
Quit

AUTHORS

PRICE

Home Page

Fundamental Concepts
Title Page

• aggregation ⇒ a collection of attributes forms an entity type (or entity set). ⇒ two entity types form a relationship type.
Page 4 of 43

• generalisation (specialisation, ISA) ⇒ E.g. Employee ISA Person and Student ISA a Person. Next

Go Back

Full Screen

Close

Quit

Example Entity Sets LECTURER Home Page $MARK $JOHN $PETER $ANDY $PAUL $CHRIS CUSTOMER $C1 $C3 $C2 $C4 Title Page STUDENT $JAMES $PAULB $DAN $MARKB ORDER $01 $02 $03 $04 $05 $06 Page 5 of 43 SQUASH-PLAYERS $ANDY $MARKB INVOICE $I1 $I3 BOOK $I2 $I4 $I5 Go Back $DAN $PAUL Full Screen Close $B1 $B2 $B3 $B4 $B5 $B6 $B7 $B8 $B9 Quit .

Example Entities $P1 Home Page SOC PNAME 45671 Jack Jill Mary Mona Lisa 187 "North London" $D2 Title Page CNAMES SPOUSE HEIGHT ADDRESS Page 6 of 43 Go Back DNAME COLLEGE "Computer Science" "UCL" "Central London" 3807777 3877050 Full Screen ADDRESS Close PHONES Quit .

Home Page Title Page Example Relationships $SPECIFIES $PLACES $01 $02 $03 $C1 $C2 $C3 $01 $02 $03 $04 $05 $06 $B1 $B2 $B3 $B4 $B5 $B6 $B7 $B8 $BILLING $01 $02 $03 $04 $05 $I1 $I2 $I3 $I4 $I5 Page 7 of 43 $04 $05 $06 Go Back Full Screen Close Quit .

Home Page Title Page The Main Advantages of ERDs • They are relatively simple • They are user friendly Page 8 of 43 • They can provide a unified view of data. which is independent of any data model. Go Back Full Screen Close Quit .

Each arc e = (u. v) in E is an ordered pair of nodes in N. Next Title Page Page 9 of 43 Go Back Full Screen Close Quit . v} in E is an unordered pair of nodes in N. or acyclic. Nodes and edges can be labeled. E) where • N is a finite set of nodes. • Graphs and digraphs can either be cyclic. and • E is a finite set of edges.Graphs Home Page A graph is an ordered pair (N. In a directed graph (or digraph) E is a set of arcs. Each edge e = {u. hierarchical.

Home Page Hierarchy Bob Title Page John Page 10 of 43 James Ray Mary Go Back Alex Full Screen Jill Close Jane Quit .

Home Page Title Page Acyclic Directed Graph Part1 Part2 Proj1 Proj2 Proj3 Page 11 of 43 Part-proj1 Go Back Part-proj2 Part-proj3 Full Screen Close Quit .

Home Page Title Page Cyclic Undirected Graph City A 100 km City B 60 km Page 12 of 43 150 km 70 km Go Back City D Full Screen 50 km City C Close Quit .

Page 13 of 43 • Domains. • (Binary) relationships and (binary) relationship types. Go Back Full Screen Close Quit .Home Page Title Page The Building Blocks of an ERD • Entities and entity sets (entity types). attribute values and attributes.

• An entity type consisting of a finite set of entities can be depicted by a graph having no edges. An entity is a ‘’thing” that exists and can uniquely be identified. An entity type (or entity set) is a collection of similar entities.Home Page Title Page Entities Definition. Page 14 of 43 Go Back Full Screen Close Quit . Definition.

Tutors and Teaches between Lecturer and Student. E.g.Home Page Title Page Relationships and their Functionality Definition. Page 15 of 43 • There may be more than one relationship type between two entity types. A (binary) relationship type is an association between two entity types. Go Back Full Screen Close Quit .

Home Page Title Page Example of M to M relationship Types TEACHES STUDENT Page 16 of 43 LECTURER TUTORS Go Back Full Screen Close Quit .

Home Page Title Page Example of M to One relationship Types RESIDES_IN EMPLOYEE Page 17 of 43 DEPARTMENT Go Back Full Screen Close Quit .

Home Page Title Page Example of One to One relationship Types RESIDES_IN MANAGER Page 18 of 43 OFFICE Go Back Full Screen Close Quit .

Example relationships Next Page 19 of 43 Go Back Full Screen Close Quit . • A relationship can be depicted by a bipartite graph between entity sets.Home Page Title Page Definition. A relationship is an instance of a relationship type. ⇒ In mathematical terms a relationship is a finite binary relation.

Go Back Full Screen Close Quit .Home Page Title Page Classification of Relationships • optional relationship An Employee may or may not be assigned to a Department Page 20 of 43 • mandatory relationship Every Course must be Taught by at least one Lecturer.

Title Page Page 21 of 43 Go Back • many-to-many A Teacher Teaches many Students and a Student is Taught by many Teachers.Continued • many-to-one (or one-to-many) An Employee Works in one Department or a Department has many Employees. Example relationships Full Screen Close Quit .Home Page Classification of Relationships . • one-to-one A Manager Heads one Department and vice versa.

Home Page Title Page Binary Versus General Relationships SUPPLIER PART PROJECT Page 22 of 43 SPP Go Back Full Screen Close Quit .

or • multi-valued (e.g.g. See ERD Page 23 of 43 Go Back Full Screen Close Quit . • Attributes can be single-valued (e.Home Page Title Page Attributes and Domains Definition of attribute. cnames and phones). Atrribute names (or simply attributes) are properties of entity types. pname and dname).

Page 24 of 43 Go Back • set-valued such as the domain of finite sets of integers or of finite sets of strings. The domain of an attribute of an entity type is the set of constant values associated with that attribute. • Domains can be atomic such as the domain of integers and the domain of strings. Full Screen Close Quit .Home Page Title Page Definition of domain.

Page 25 of 43 • The attribute values of entities can be depicted by a bipartite graph from attributes to their values. This value is denoted by att(e).Home Page Title Page Definition of attribute value. Go Back Full Screen Close Quit . An attribute. say att of an entity type E associates a value from its domain with each each entity e of E.

Definition of a key.Home Page Keys and Superkeys Definition of a superkey. A set of attributes of an entity type is a superkey if for each entity. A key for an entity type is a superkey which is minimal. Full Screen Close Quit . • composite are keys have more than one attribute. such as {Dname. such as E# ans SOC#. College} and {Pname. say e. Title Page Page 26 of 43 Go Back • simple keys are single attribute keys. over that type. Address}. the set of attribute values of the attributes in the superkey uniquely identify e.

A primary key is a key. Page 27 of 43 • The primary key guarantees logical access to every entity. Go Back Full Screen Close Quit .Home Page Title Page Definition of primary key of an entity type. which is designated by the database designer.

(see one to one relationships). If R is one-to-one the primary key of R is either K1 or K2.Home Page Definition of primary key of a relationship type R. (see one to many relationship types). If R is one-to-many the primary key of R is K2. (see many to one relationship types). If R is many-to-one the primary key of R is K1. 3. 2. 4. (see many to many relationship types). If R is many-to-many the primary key of R is K1 ∪ K2. 1. • R is a relationship type between E1 with primary key K1 and E2 with primary key K2. Title Page Page 28 of 43 Go Back Full Screen Close Quit .

With each entity type in a cyclic relationship type we associate a role.g. Next Title Page Page 29 of 43 Go Back Full Screen Close Quit . {Husband Soc#. • Marriage between Person and itself. • Parent-Child between Person and itself. • Part-Sub-Part between Part and itself. A cyclic relationship type (also called recursive) is a relationship type between two occurrences of the same entity type.Cyclic Relationships Home Page Definition. • We add the roles to the primary key attributes to form the primary key of the relationship E. Wife Soc#} is the primary key of Marriage assuming Soc# is the primary key of Person.

Home Page Title Page Example of a Cyclic Relationship Type PERSON Page 30 of 43 Go Back Full Screen Close Quit .

Home Page Title Page Example of Roles in a Cyclic Relationship Type PERSON WIFE Page 31 of 43 HUSBAND MARRIAGE Go Back Full Screen Close Quit .

• ISA relationship type An Employee is a special case of Person and therefore the existence of an Employee entity implies the existence of a corresponding Person entity.Home Page Weak Entity Types Title Page • ID relationship type In an employees database Child entities exist only if their corresponding Parent employee entity exists. Page 32 of 43 Go Back Full Screen Close Quit .

Home Page ISA Relationships NAME AGE ADDRESS Title Page SALARY PERSON ISA ISA COURSE Page 33 of 43 DNAME Go Back EMPLOYEE ISA STUDENT ISA DNAME SUPERVISOR Full Screen PHD_STUDENT Close Quit .

ID Relationships Home Page ADDRESS Title Page AGE SOC# PNAME PARENT ID Page 34 of 43 CHILD Go Back Full Screen CNAME AGE Close Quit .

Page 35 of 43 Go Back Full Screen Close Quit . Definition of ID relationship type. then I1 is a subset of I2. if in the database I1 is the set of instances of E1 and I2 is the set of instances of E2. Definition of ISA relationship type. E1 ID E2 if the primary key of E1 is composed of the primary key of E2 plus one or more attributes of E1. In addition. • If Employee ISA Person then Employee inherits all the attributes of Person.Home Page Title Page Let E1 and E2 be entity types. E1 ISA E2 if the primary key of E1 is also the primary key of E2.

e. all occurrences of attributes in an ERD have the same meaning.g. Full Screen Close Quit . I. E. ⇒ The URSA is important in relational database design. Each attribute of an entity type plays a unique role in the ERD.Home Page Title Page The Universal (URSA) Relation Schema Assumption Page 36 of 43 Go Back Definition. Name can be department name or Person name and therefore needs to be modified to Dname and Pname.

Home Page Title Page Example Illustrating the UR Problem ASSIGNED_TO EMPLOYEE DEPARTMENT Page 37 of 43 NAME Go Back SALARY NAME MANAGER Full Screen Close Quit .

Home Page Title Page 3. if it is a one-to-one. if you are familiar with DD notation then give the DD definitions of the domains. Add the attributes and keys to the ERD drawn in step 6. Go Back Full Screen Close Quit . Identify the relationships (including ISA and ID relationships) of the enterprise. Identify the attributes of entity types and their underlying domain. 5. Identify the entity types (including weak entity types) of the enterprise. 7. 10. many-to-one or many-to-many. 2. 8. Draw some instances of attribute values of entities. 9. Draw some instances of the identified entity types. i. e. 4. Draw some instances of the identified relationships. Classify each relationship identified in step 3 according to its functionality. Identify a primary key for each entity type. Draw an ERD with the entity types and the relationships between them.An Informal Algorithm for Constructing an ERD 1. Page 38 of 43 6.

Basic ERD Constructs Home Page Basic ERD Constructs Concept Representation Example Title Page Entity type BOOK Relationship type Page 39 of 43 PLACES Attribute Go Back PRICE Full Screen Primary key attribute ISBN Close Quit .

Attribute Constructs Attribute Constructs Home Page Concept Representation Example Title Page Single-valued attribute CUSTOMER NAME C# Page 40 of 43 Go Back Full Screen Multi-valued attribute Close CUSTOMER PHONES Quit .

Relationships Constructs Home Page Basic ERD Constructs Concept Representation Example ASSIGNED_TO Title Page Many-to-one EMPLOYEE EMPLOYS DEPARTMENT One-to-many Page 41 of 43 DEPARTMENT EMPLOYEE One-to-one Go Back HAS MANAGER WORKS_FOR SECRETARY Full Screen Many-to-many EMPLOYEE PROJECT Close Quit .

Home Page Title Page Built-in Relationship Constructs Built-in Relationship Types Concept Representation ISA Example ISA ISA Page 42 of 43 STUDENT PERSON ID Go Back ID CHILD ID PARENT Full Screen Close Quit .

The entity-relationship model .toward a unified view of data. Chen.-S. Home Page Title Page Page 43 of 43 Go Back Full Screen Close Quit . ACM Transactions on Database Systems. 1:9–36.References [Che76] P. 1976.P.

Sign up to vote on this title
UsefulNot useful