1 / 21

An Example: Video Rental System

Video Rental Database. Videos. Customers. Rentals. An Example: Video Rental System. E-R Analysis …. Similar objects are grouped into entity sets

loren
Télécharger la présentation

An Example: Video Rental System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Video Rental Database Videos Customers Rentals An Example: Video Rental System

  2. E-R Analysis … • Similar objects are grouped into entity sets • Determine the attributes (or properties) of objects in the sets. Usually choose one of the attributes of an entity or relationship set to be the identifier • Model all interactions between the objects in the entity sets by relationship and relationship sets • Model relationship cardinality • Model relationship participation

  3. ERD Example MOVIE CUSTOMER PRODUCER

  4. E-R Analysis … • Similar objects are grouped into entity sets • Determine the attributes (or properties) of objects in the sets. Usually choose one of the attributes of an entity or relationship set to be the identifier • Model all interactions between the objects in the entity sets by relationship and relationship sets • Model relationship cardinality • Model relationship participation

  5. Attributes • Attribute - property or characteristic of an entity type • Classifications of attributes: • Required versus Optional Attributes • Simple versus Composite Attribute (e.g. name) • Single-Valued versus Multi-valued Attribute (e.g Qualifications) • Stored versus Derived Attributes (e.g Age & DoB) • Identifier Attributes • Identifier - An attribute (or combination of attributes) that uniquely identifies individual instances of an entity type • Simple Key versus Composite Key

  6. _______ __________ ERD Example Title FIrstName LastName MovieID Duration CustomerID Address Rating MOVIE CUSTOMER PhoneNumber BirthDate CompanyID PRODUCER CompanyName Country

  7. E-R Analysis … • Similar objects are grouped into entity sets • Determine the attributes (or properties) of objects in the sets. Usually choose one of the attributes of an entity or relationship set to be the identifier • Model all interactions between the objects in the entity sets by relationship and relationship sets • Model relationship cardinality • Model relationship participation

  8. Relationships • Relationship Types vs. Relationship Instances • The relationship type is modelled as the diamond and lines between entity types…the instance is between specific entity instances • Relationships can have attributes • These describe features pertaining to the association between the entities in the relationship • Two entities can have more than one type of relationship between them (multiple relationships) • Associative Entity – combination of relationship and entity

  9. ERD Example Title FIrstName LastName MovieID Duration CustomerID Address Rating rent MOVIE CUSTOMER PhoneNumber directed BirthDate Date_Rented Due_Date companyID PRODUCER CompanyName Country

  10. E-R Analysis … • Similar objects are grouped into entity sets • Determine the attributes (or properties) of objects in the sets. Usually choose one of the attributes of an entity or relationship set to be the identifier • Model all interactions between the objects in the entity sets by relationship and relationship sets • Model relationship cardinality • Model relationship participation

  11. Cardinality of Relationships • One-to-One • Each entity in the relationship will have exactly one related entity • One-to-Many • An entity on one side of the relationship can have many related entities, but an entity on the other side will have a maximum of one related entity • Many-to-Many • Entities on both sides of the relationship can have many related entities on the other side

  12. ERD Example Title FIrstName LastName MovieID Duration CustomerID Address Rating rent MOVIE CUSTOMER PhoneNumber directed BirthDate Date_Rented Due_Date CompanyID PRODUCER CompanyName Country

  13. E-R Analysis … • Similar objects are grouped into entity sets • Determine the attributes (or properties) of objects in the sets. Usually choose one of the attributes of an entity or relationship set to be the identifier • Model all interactions between the objects in the entity sets by relationship and relationship sets • Model relationship cardinality • Model relationship participation

  14. ERD Example Title FIrstName LastName MovieID Duration CustomerID Address Rating rent MOVIE CUSTOMER PhoneNumber directed BirthDate Date_Rented Due_Date CompanyID PRODUCER CompanyName Country

  15. Mapping Rules (Simplified) • Map Regular Entities • Map Binary Relationships • One-to-many Relationships • Many-to-many relationships

  16. Title MovieID Duration Rating MOVIE Mapping Regular Entities MOVIE MovieID Title Duration Rating

  17. Mapping One-to-many relationships Title MovieID Duration Rating MOVIE MOVIE MovieID Title Rating Rating DirectorID directed PRODUCERR CompanyID CompanyName Country CompanyID PRODUCER CompanyName Country

  18. Mapping Many-to-many relationships Title FIrstName LastName MovieID Duration CustomerID Address Rating rent MOVIE CUSTOMER PhoneNumber BirthDate Date_Rented Due_Date MOVIE MovieID Title Rating Duration RENTAL Due_Date MovieID CustomerID Due_Rented CUSTOMER CustomerID FName LName Address DoB Phone

  19. PRODUCERR CompanyID CompanyName Country Final Map MOVIE MovieID Title Rating Audience CompanyID RENTAL Due_Date MovieID CustomerID Due_Rented CUSTOMER CustomerID FName LName Address DoB Phone

  20. RENTAL CustomerID (FK) MovieID (FK) Date_Rented Date_Due CUSTOMER CustomerID(PK) FName LName Address Phone DoB MOVIE MovieID (PK) Title Audience Duration DirectorID (FK) PROCUER CompnayID (PK) CompanyName Country Resulting 4 Tables Any problems with Rental Table ?

  21. Metadata for Customer • Customer • FirstName Character 30 First name • LastName Character 30 Last name • Address Character 60 Location • PhoneNumber Character 10 Telephone • BirthDate Date DD-MM-YY • CustomerID Character 8 Unique ID

More Related