more data modeling cs 146. relationship lower bounds lower bound: minimum number of related...
DESCRIPTION
More Lower Bound Examples Store Store_ID Store_Address Video Video_ID Video_Title Video_Format Customer Customer_ID Customer_Name Customer_Address Rents Spouse Spouse_ID Spouse_Name HasTRANSCRIPT
![Page 1: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/1.jpg)
More Data ModelingCS 146
![Page 2: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/2.jpg)
Relationship Lower Bounds Lower bound: minimum number of related
instances in a relationship Value is typically 0 or 1
StoreStore_IDStore_Address
VideoVideo_IDVideo_TitleVideo_Format
Rents
“A store rents 0 to many videos”
“A video can be rented by 1 and only 1 store”
![Page 3: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/3.jpg)
More Lower Bound Examples
StoreStore_IDStore_Address
VideoVideo_IDVideo_TitleVideo_Format
CustomerCustomer_IDCustomer_NameCustomer_Address
Rents
Rents
SpouseSpouse_IDSpouse_Name
Has
![Page 4: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/4.jpg)
How Do You Select Upper and Lower Bounds? Business rules of the organization Database design decisions
Example: Auto service center
Guidelines: Make the system as flexible as possible Avoid M:M relationships when possible
Increase system complexity
CarCar_IDCar_MakeCar_ModelCar_Year
CustomerCustomer_IDCustomer_NameCustomer_Address
owns
? ?
![Page 5: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/5.jpg)
Composite Relationship Occurs for a relationship that has attributes Always has M:M cardinality
CourseGrade
StudentStudentID
StudentFirstNameStudentLastNameStudentAddress
StudentDOBStudentClass
EnrollsIn
CourseSectionCourseID
CourseDayCourseTime
CourseLocation
Attribute ofthe relationship
![Page 6: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/6.jpg)
Composite Relationships:Another Example
HoursEmployee
EmployeeIDEmployeeName
WorksOn ProjectProjectID
ProjectName
Attribute ofthe relationship
![Page 7: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/7.jpg)
CourseCourseID
CourseNameCourseDayCourseTime
CourseLocation
EnrollmentEnrollmentIDCourseGrade
StudentStudentID
StudentFirstNameStudentLastNameStudentAddress
StudentDOBStudentClass
Decomposing a Composite Relationship
Can always be decomposed into 2 1:M relationships!
CourseGrade
StudentStudentID
StudentFirstNameStudentLastNameStudentAddress
StudentDOBStudentClass
EnrollsIn
CourseCourseID
CourseNameCourseDayCourseTime
CourseLocation
Has Has
Note the direction of the 1:Ms!
![Page 8: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/8.jpg)
Degree of a Relationship Specifies the number of entities that
participate in a relationship Up until now, all relationships have been
binary (2 entities)
VideoVideo_IDVideo_TitleVideo_Format
CustomerCustomer_IDCustomer_NameCustomer_Address
rents
![Page 9: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/9.jpg)
Unary Relationships Entity has a relationship with itself
![Page 10: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/10.jpg)
Ternary Relationships Relationship exists among 3 entities
UniversityStudent
PK StudentID
StudentFirstName StudentMI StudentLastName StudentDOB
UniversityCourse
PK CourseID
CourseName CourseDescription
UniversityTutor
PK TutorID
TutorFirstName TutorMI TutorLastNameSessionDate
SessionTimeSessionOutcome
![Page 11: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/11.jpg)
Generalization/Specialization Relationships Do not show cardinalities
Supertype
Subtypes
UniversityPerson
PK PersonID
PersonFirstName PersonLastName
StudentPerson
PK StudentID
StudentMajor StudentCreditHours
FacultyPerson
PK FacultyID
FacDepartment FacRank FacSalary
StaffPerson
PK StaffID
StaffTitle StaffLevel StaffHourlyRate
![Page 12: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/12.jpg)
How common are these? Unary
Rare Ternary, Generalization/Specialization
More common than you would think
Be aware that they can exist and how you represent them!
![Page 13: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/13.jpg)
Homonyms Homonym: different attributes
have the same nameAvoid!Attributes should take their name
from their entityUniversityStudent
PK StudentID
Name
UniversityInstructor
PK InstructorID
Name
![Page 14: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/14.jpg)
Synonyms Synonym: same attribute has
different names in different tables FK field should have same name as
PK field, unless another name makes it A LOT more descriptive
How should you change these entities?
![Page 15: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/15.jpg)
Strategies for Developing ER Models How do you decide if an item is an entity or
an attribute? An item is an entity if…
An item is an attribute if…
![Page 16: More Data Modeling CS 146. Relationship Lower Bounds Lower bound: minimum number of related instances in a relationship Value is typically 0 or 1](https://reader036.vdocuments.net/reader036/viewer/2022062317/5a4d1af67f8b9ab05998177a/html5/thumbnails/16.jpg)
Strategies for Associating an Attribute With the Correct Entity To which entity does an attribute belong?
Example: Is AdvisorName an attribute of a UniversityStudent instance?
Answer: Only if each advisor only advises only one student. Otherwise, you are repeating the name multiple times.
The ONLY thing that you can repeat in tables is a foreign key value!
Strategy: If a non-attribute appears in multiple entities, it
is not associated with the correct entity