ERModel PDF
ERModel PDF
ERModel PDF
Slide 3- 1
Database Design Process
Slide 3- 3
Example COMPANY Database
Slide 3- 4
Example COMPANY Database (Contd.)
Slide 3- 5
•Usually a noun in singular
ER Model Concepts •Represented by a
rectangle with a label
•First letter in capitals
Slide 3- 6
Types of Attributes (1)
• Simple
– Each entity has a single atomic value for the attribute. For
example, SSN or Sex.
• Composite
– The attribute may be composed of several components. For
example:
• Address(Apt#, House#, Street, City, State, ZipCode, Country),
or
• Name(FirstName, MiddleName, LastName).
• Composition may form a hierarchy where some components
are themselves composite.
• Multi-valued
– An entity may have multiple values for that attribute. For
example, Color of a CAR or PreviousDegrees of a STUDENT.
• Denoted as {Color} or {PreviousDegrees}.
Slide 3- 7
Types of Attributes (2)
Slide 3- 8
Example of a composite attribute
Slide 3- 9
Entity Types and Key Attributes (1)
Slide 3- 10
Entity Types and Key Attributes (2)
Slide 3- 12
Entity Type CAR with two keys and a
corresponding Entity Set
Slide 3- 13
Entity Set
Slide 3- 14
Initial Design of Entity Types for the COMPANY
Database Schema
Slide 3- 16
Refining the initial design by introducing
relationships
Slide 3- 17
Relationships and Relationship Types (1)
Slide 3- 18
Relationship instances of the WORKS_FOR N:1 relationship
between EMPLOYEE and DEPARTMENT
Slide 3- 19
Relationship instances of the M:N WORKS_ON
relationship between EMPLOYEE and PROJECT
Slide 3- 20
Relationship type vs. relationship set (1)
• Relationship Type:
– Is the schema description of a relationship
– Identifies the relationship name and the
participating entity types
– Also identifies certain relationship constraints
• Relationship Set:
– The current set of relationship instances
represented in the database
– The current state of a relationship type
Slide 3- 21
Relationship type vs. relationship set (2)
Slide 3- 22
Refining the COMPANY database schema by
introducing relationships
Slide 3- 23
ER DIAGRAM – Relationship Types are:
WORKS_FOR, MANAGES, WORKS_ON, CONTROLS, SUPERVISION, DEPENDENTS_OF
Slide 3- 24
Discussion on Relationship Types
Slide 3- 25
Recursive Relationship Type
Slide 3- 26
Weak Entity Types
Slide 3- 27
Constraints on Relationships
Slide 3- 28
Many-to-one (N:1) Relationship
Slide 3- 29
Many-to-many (M:N) Relationship
Slide 3- 30
Displaying a recursive relationship
Slide 3- 31
A Recursive Relationship Supervision`
Slide 3- 32
Recursive Relationship Type is: SUPERVISION
(participation role names are shown)
Slide 3- 33
Attributes of Relationship types
Slide 3- 34
Example Attribute of a Relationship Type:
Hours of WORKS_ON
Slide 3- 35
Notation for Constraints on Relationships
Slide 3- 36
Alternative (min, max) notation for
relationship structural constraints:
Slide 3- 37
The (min,max) notation for relationship
constraints
Read the min,max numbers next to the entity type and looking
away from the entity type
Slide 3- 38
COMPANY ER Schema Diagram using (min, max)
notation
Slide 3- 39
Alternative diagrammatic notation
Slide 3- 40
Summary of notation for ER diagrams
Slide 3- 41
UML class diagrams
Slide 3- 42
UML class diagram for COMPANY database
schema
Slide 3- 43
Other alternative diagrammatic notations
Slide 3- 44
Relationships of Higher Degree
Slide 3- 45
Discussion of n-ary relationships (n > 2)
Slide 3- 46
Example of a ternary relationship
Slide 3- 47
Discussion of n-ary relationships (n > 2)
Slide 3- 48
Another example of a ternary relationship
Slide 3- 49
Displaying constraints on higher-degree
relationships
Slide 3- 50
Data Modeling Tools
Slide 3- 51
Some of the Currently Available
Automated Database Design Tools
COMPANY TOOL FUNCTIONALITY
Embarcadero ER Studio Database Modeling in ER and IDEF1X
Technologies
DB Artisan Database administration, space and security
management
Oracle Developer 2000/Designer 2000 Database modeling, application development
Popkin System Architect 2001 Data modeling, object modeling, process modeling,
Software structured analysis/design
Platinum Enterprise Modeling Suite: Data, process, and business component modeling
(Computer Erwin, BPWin, Paradigm Plus
Associates)
Persistence Pwertier Mapping from O-O to relational model
Inc.
Rational (IBM) Rational Rose UML Modeling & application generation in C++/JAVA
Resolution Ltd. Xcase Conceptual modeling up to code maintenance
Sybase Enterprise Application Suite Data modeling, business logic modeling
Visio Visio Enterprise Data modeling, design/reengineering Visual Basic/C++
Slide 3- 52
Extended Entity-Relationship (EER) Model
(in next chapter)
Slide 3- 53
Chapter Summary
Slide 3- 54
ER Model to Relational Mapping
PartNum
part
Tables that already exist:
Supplier (sname, …)
Job (jname, …)
Part (partNum, …)
Add new Table:
Supply (sname, jname, partNum, quantity, …)
sname is FK -> Supplier (sname)
jname is FK -> Job (jname)
partNum is FK -> Part (partNum)
Binary version of n-ary example
N M
supplier Supplies job
N N
PartNum
Can supply Uses
M M
part
74
Solution to binary version of n-ary
Supplier (sname, …)
Job (jname, …)
Part (partNum, …)
75
Constraints
Examples:
ALTER TABLE emp_demo4 MODIFY (<Column name> <datatype> CONSTRAINT constraint_name NOT
NULL);
Drop Constraints