DB 02 TP
DB 02 TP
Dr Mohamad AOUDE
December 3, 2024
LU
1 Dr Mohamad AOUDE
Outline
Chapter 2 Outline
2 Dr Mohamad AOUDE
Chapter 2 Outline (cont’d.)
3 Dr Mohamad AOUDE
Data Modeling Using the
Entity-Relationship (ER) Model
Data Modeling Using the Entity-Relationship (ER) Model
4 Dr Mohamad AOUDE
Using High-Level Conceptual
Data Models for Database
Design
Using High-Level Conceptual Data Models for Database Design
5 Dr Mohamad AOUDE
Using High-Level Conceptual Data Models (cont’d.)
Conceptual schema
Conceptual design
Description of data requirements
Includes detailed descriptions of the entity types, relationships, and
constraints
Transformed from high-level data model into implementation data
model
6 Dr Mohamad AOUDE
Using High-Level Conceptual Data Models (cont’d.)
7 Dr Mohamad AOUDE
A Sample Database Application
A Sample Database Application
COMPANY
Employees, departments, and projects
Company is organized into departments
Department controls a number of projects
Employee: store each employee’s name, Social Security number,
address, salary, sex (gender), and birth date
Keep track of the dependents of each employee
8 Dr Mohamad AOUDE
A Sample Database Application
9 Dr Mohamad AOUDE
Entity Types, Entity Sets,
Attributes, and Keys
Entity Types, Entity Sets, Attributes, and Keys
10 Dr Mohamad AOUDE
Entities and Attributes
Entity
Thing in real world with independent existence
Attributes
Particular properties that describe entity
Types of attributes:
Composite versus simple (atomic) attributes
Single-valued versus multivalued attributes
Stored versus derived attributes
NULL values
Complex attributes
11 Dr Mohamad AOUDE
Entities and Attributes
12 Dr Mohamad AOUDE
Entity Types, Entity Sets, Keys, and Value Sets
13 Dr Mohamad AOUDE
Entity Types, Entity Sets, Keys, and Value Sets
Entity type
Collection (or set) of entities that have the same attributes
Key or uniqueness constraint
Attributes whose values are distinct for each individual entity in
entity set
Key attribute
Uniqueness property must hold for every entity set of the entity type
Value sets (or domain of values)
Specifies set of values that may be assigned to that attribute for
each individual entity
14 Dr Mohamad AOUDE
Initial Conceptual Design of the COMPANY Database
15 Dr Mohamad AOUDE
Initial Conceptual Design of the COMPANY Database
16 Dr Mohamad AOUDE
Relationship Types, Relationship
Sets, Roles, and Structural
Constraints
Relationship Types, Relationship Sets, Roles, and Structural
Constraints
Relationship
When an attribute of one entity type refers to another entity type
Represent references as relationships not attributes
17 Dr Mohamad AOUDE
Relationship Types, Sets, and Instances
18 Dr Mohamad AOUDE
Relationship
19 Dr Mohamad AOUDE
Relationship Degree
20 Dr Mohamad AOUDE
Relationship
21 Dr Mohamad AOUDE
Role Names and Recursive Relationships
22 Dr Mohamad AOUDE
Constraints on Binary Relationship Types
23 Dr Mohamad AOUDE
Attributes of Relationship Types
24 Dr Mohamad AOUDE
Weak Entity Types
Weak Entity Types
25 Dr Mohamad AOUDE
Refining the ER Design for the
COMPANY Database
Refining the ER Design for the COMPANY Database
26 Dr Mohamad AOUDE
ER Diagrams, Naming
Conventions, and Design Issues
ER Diagrams, Naming Conventions, and Design Issues
27 Dr Mohamad AOUDE
Proper Naming of Schema Constructs
28 Dr Mohamad AOUDE
Design Choices for ER Conceptual Design
29 Dr Mohamad AOUDE
Alternative Notations for ER
Diagrams
Alternative Notations for ER Diagrams
30 Dr Mohamad AOUDE
Alternative Notations for ER Diagrams
31 Dr Mohamad AOUDE
Example of Other Notation:
UML Class Diagrams
UML Class Diagrams
32 Dr Mohamad AOUDE
Example of Other Notation: UML Class Diagrams
UML methodology
Used extensively in software design
Many types of diagrams for various software design purposes
UML class diagrams
Entity in ER corresponds to an object in UML
33 Dr Mohamad AOUDE
Example of Other Notation: UML Class Diagrams (cont’d.)
34 Dr Mohamad AOUDE
Relationship Types of Degree
Higher than Two
Relationship Types of Degree Higher than Two
35 Dr Mohamad AOUDE
Choosing Between Binary and
Ternary Relationships
Choosing Between Binary and Ternary (or Higher-Degree) Re-
lationships
36 Dr Mohamad AOUDE
Constraints on Ternary
Relationships
Constraints on Ternary (or Higher-Degree) Relationships
37 Dr Mohamad AOUDE
Choosing between Binary and Ternary
38 Dr Mohamad AOUDE
Summary
Summary
39 Dr Mohamad AOUDE
Problem 1 Statement
Problem 1 Statement
Student:
Attributes: Name, Student Number (unique), SSN (unique), Current
Address/Phone, Permanent Address/Phone, Birth Date, Sex, Class,
Major Department, Minor Department (if any), Degree Program.
Note: Permanent address includes city, state, and ZIP Code.
Department:
Attributes: Name (unique), Department Code (unique), Office
Number, Office Phone, College.
Course:
Attributes: Course Name, Description, Course Number (unique),
Number of Semester Hours, Level, Offering Department.
Section:
Attributes: Instructor, Semester, Year, Course, Section Number.
Note: Section Number distinguishes sections of the same course in
the same semester/year.
Grade Report:
Attributes: Student, Section, Letter Grade, Numeric Grade (0-4).
42 Dr Mohamad AOUDE
ER Schema Design Exercise
Student:
name (first, last)
student number (unique)
Social Security number (unique)
class (freshman, sophomore, ...)
major
degree program (B.A., B.S., ..., Ph.D.)
permanent address (city, state, ZIP)
Department:
name (unique)
department code (unique)
office number
office phone number
college
43 Dr Mohamad AOUDE
ER Schema Design Exercise
Course:
course name
description
course number (unique)
number of semester hours
level
offering department
Section:
instructor
semester
year
course
section number (1, 2, 3, ...)
Grade Report:
student
section
letter grade
numeric grade (0, 1, 2, 3, or 4)
44 Dr Mohamad AOUDE
ER Diagram
Structural Constraints and Key
Attributes
Structural Constraints and Key Attributes
Student:
Key: Student Number (unique), SSN (unique).
Relationships:
Belongs to Major Department: Total Participation.
Enrolled in Section: Total Participation.
Department:
Key: Name (unique), Department Code (unique).
Relationships:
Offers Course: Total Participation.
Course:
Key: Course Number (unique).
Relationships:
Offered by Department: Total Participation.
Taught in Section: Total Participation.
Section:
Key: Combination of Course and Section Number.
Relationships:
Graded in Grade Report: Total Participation.
45 Dr Mohamad AOUDE
Tasks
46 Dr Mohamad AOUDE
Choosing between Binary and Ternary
47 Dr Mohamad AOUDE
STUDENT Table
48 Dr Mohamad AOUDE
Course Information
COURSE Table
49 Dr Mohamad AOUDE
Section Information
SECTION Table
50 Dr Mohamad AOUDE
Grade Report
GRADE REPORT Table
51 Dr Mohamad AOUDE
UML
52 Dr Mohamad AOUDE