Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Example: Video Rental System Video Rental Database Videos RentalsCustomers.

Similar presentations


Presentation on theme: "An Example: Video Rental System Video Rental Database Videos RentalsCustomers."— Presentation transcript:

1 An Example: Video Rental System Video Rental Database Videos RentalsCustomers

2 E-R Analysis … 1.Similar objects are grouped into entity sets 2.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 3.Model all interactions between the objects in the entity sets by relationship and relationship sets 4.Model relationship cardinality 5.Model relationship participation

3 ERD Example MOVIECUSTOMER PRODUCER

4 E-R Analysis … 1.Similar objects are grouped into entity sets 2.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 3.Model all interactions between the objects in the entity sets by relationship and relationship sets 4.Model relationship cardinality 5.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 MOVIE MovieID Title Duration CUSTOMER CustomerID FIrstName Address PRODUCER CompanyNameCountry Rating LastName PhoneNumber BirthDate _______ __________ CompanyID

7 E-R Analysis … 1.Similar objects are grouped into entity sets 2.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 3.Model all interactions between the objects in the entity sets by relationship and relationship sets 4.Model relationship cardinality 5.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 MOVIE MovieID Title Duration CUSTOMER CustomerID FIrstName Address rent PRODUCER directed CompanyNameCountry Rating LastName PhoneNumber BirthDate companyID Date_RentedDue_Date

10 E-R Analysis … 1.Similar objects are grouped into entity sets 2.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 3.Model all interactions between the objects in the entity sets by relationship and relationship sets 4.Model relationship cardinality 5.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 MOVIE MovieID Title Duration CUSTOMER CustomerID FIrstName Address rent Date_Rented PRODUCER directed CompanyNameCountry Rating LastName PhoneNumber BirthDate Due_Date CompanyID

13 E-R Analysis … 1.Similar objects are grouped into entity sets 2.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 3.Model all interactions between the objects in the entity sets by relationship and relationship sets 4.Model relationship cardinality 5.Model relationship participation

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

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

16 Mapping Regular Entities MOVIE MovieID Title Duration Rating MovieIDTitleDurationRating MOVIE

17 Mapping One-to-many relationships MovieIDTitleRating CompanyNameCompanyIDCountry MOVIE MovieID Title Duration directed Rating DirectorID MOVIE PRODUCERR PRODUCER CompanyNameCountry CompanyID

18 Mapping Many-to-many relationships MOVIE MovieID Title Duration CUSTOMER CustomerID FIrstName Address rent Date_Rented Rating LastName PhoneNumber BirthDate Due_Date MovieIDTitleRatingDuration CustomerIDFNameAddress MOVIE CUSTOMER DoBPhoneLName Due_Rented RENTAL MovieIDCustomerID Due_Date

19 Final Map MovieIDTitleRatingAudience CustomerIDFNameAddress MOVIE CUSTOMER DoBPhoneLName Due_Rented RENTAL MovieIDCustomerID Due_Date CompanyID CompanyNameCompanyIDCountry PRODUCERR

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

21 Metadata for Customer  Customer  FirstNameCharacter30First name  LastNameCharacter30Last name  AddressCharacter 60 Location  PhoneNumberCharacter10Telephone  BirthDateDateDD-MM-YY  CustomerIDCharacter 8Unique ID


Download ppt "An Example: Video Rental System Video Rental Database Videos RentalsCustomers."

Similar presentations


Ads by Google