Download presentation
Presentation is loading. Please wait.
Published byGilbert Burns Modified over 6 years ago
1
COP5725 Database Management ER DIAGRAM AND RELATIONAL DATA MODEL
Prof: Dr. Shu-Ching Chen TA: Sheng Guan
2
Entity-Relationship Model
3
E- R Data Modeling Example: specific person, company, event, plant
An entity is an object that exists and is distinguishable from other objects. Example: specific person, company, event, plant Entities have attributes Example: people have names and addresses An entity set is a set of entities of the same type that share the same properties. Example: set of all persons, companies, trees, holidays
4
Attributes An entity is represented by a set of attributes, that is descriptive properties possessed by all members of an entity set. Example: instructor = (ID, name, street, city, salary ) course= (course_id, title, credits) Attribute types: Simple and composite attributes. Single-valued and multivalued attributes Derived attributes
5
Relationship Sets A relationship is an association among several entities Example: (Peltier) advisor (Einstein) student entity relationship set instructor entity
6
Entity-Relationship Diagrams
Representing entities we represent an entity by a named rectangle use a singular noun, or adjective + noun refer to one instance in naming CUSTOMER PART-TIME EMPLOYEE
7
Entity-Relationship Diagrams
Representing relationship DEPT EMPLOYEE employs
8
Entity-Relationship Diagrams
One to one One to many
9
Entity-Relationship Diagrams
Many-to-many relationship (M:N): exists when one instance of the first entity can relate to many instances of the second entity, and one instance of the second entity can relate to many instances of the first entity. (c) Many to many
10
E-R Diagram for a University
11
The Relational Data Model
Database Model (ODL, E/R) Relational Schema Physical storage Complex file organization and index structures. ODL definitions Diagrams (E/R) Tables: row names: attributes rows: tuples
12
Terminology Attribute names Name Price Category Manufacturer
gizmo $ gadgets GizmoWorks Power gizmo $ gadgets GizmoWorks SingleTouch $ photography Canon MultiTouch $ household Hitachi tuples
13
More Terminology Every attribute has an atomic type.
Relation Schema: relation name + attribute names + attribute types Relation instance: a set of tuples. Only one copy of any tuple! Database Schema: a set of relation schemas. Database instance: a relation instance for every relation in the schema.
14
name category name price makes Company Product Stock price buys employs Person name ssn address
15
Entity Sets to Relations
name category price Product Product: Name Category Price gizmo gadgets $19.99
16
Relationships to Relations
Start Year name category name makes Company Product Stock price Relation MAKES (watch out for attribute name conflicts) Product-name Product-Category Company-name Starting-year gizmo gadgets gizmoWorks
17
Handling Weak Entity Sets
affiliation Team University sport number name Relation TEAM: Sport Number University-name mud wrestling Montezuma State U. - need all the attributes that contribute to the key of Team - don’t need a separate relation for Affiliation.
18
Relational Data Model Key point: Indicate your primary key
Define attribute’s data type Indicate the relationship
19
ER Model to Relational Model
20
Populate your relation
Key point: At least five records are needed for each table. Also indicate the PK here.
21
Constraint Key point: Indicate the constraint at the end
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.