Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
CS 146
Class models
Goes beyond data, also models behaviors
Identify entities
2.
3.
Specify relationships
Data Entities
Entity
UWEC_STUDENT, CANDY_PRODUCT,
Entity names will ultimately correspond to table
names
Why singular?
Entity instance
ER Model Attributes
Attribute
Attribute value
ER Model Notation
Entity
Primary key
Attributes
Primary key
Atomic
Composite
Multi-valued
Derived
SKU
ISBN
VIN
"James B. Brown"
"5580 Pinewood Road, Eau Claire, WI 54701"
Should you ever allow a composite attribute in a
database?
Composite Attributes
Sorting
Searching
Formatting
Student
Student_ID
Student_Name
Student_Address
Student_DOB
Student_Class
Student_First_Name
Student_MI
Student_Last_Name
Student_Address_Line_1
Student_Address_Line_2
Student_City
Student_State
Student_Country
Student_Postal_Code
Multi-Valued Attributes
Student
Employee
Student_ID (PK)
Student_First_Name
Student_Last_Name
Student_Address
Student_DOB
Student_Class
Student_Phone1
Student_Phone2
Employee_ID (PK)
Employee_First_Name
Employee_Last_Name
Employee_Address
Employee_DOB
Employee_Dependent1
Employee_Dependent2
Student
Student_ID
Student_First_Name
Student_Last_Name
Student_Address
Student_DOB
Student_Class
Student_Phone1
Student_Phone2
Employee
Dependent
Employee_ID
Employee_First_Name
Employee_Last_Name
Employee_Address
Employee_DOB
Employee_Dependent1
Employee_Dependent2
Dependent_ID
Dependent_Name
has
Derived Attributes
Examples:
PRODUCT_PRICE, COURSE_CREDITS
Identify entities
2.
3.
Specify relationships
1:M
1:1
M:M
M denotes some value greater than 1 whose
upper bound is undetermined
This is called relationship cardinality
Store
Store_ID
Store_Name
Store_Address
Store_ID
Store_Name
Store_Address
Northside
Southside
Video_ID
Video_Title
Video_Format
1000
DVD
1001
Sideways
Bluray
1002
Just Visiting
DVD
1003
Crash
Bluray
Rents
Video
Video_ID
Video_Title
Video_Format
Spouse
Spouse_ID
Spouse_Name
Spouse_ID
Spouse_Name
52
Ryan, Judy
53
Redmann, Rudy
Has
Customer
Customer_ID
Customer_Name
Customer_Address
Customer_
ID
Customer_
Name
Customer_Address
Ryan, Paul
Myers, Mary
Video
Video_ID
Video_Title
Rents
Customer
Customer_ID
Customer_Name
Customer_Address
Example ER Model
Define entities
Define attributes
Define relationships