Presentation is loading. Please wait.

Presentation is loading. Please wait.

ER example : movie & category

Similar presentations


Presentation on theme: "ER example : movie & category"— Presentation transcript:

1

2 ER example : movie & category
M_id Title Cat_id 10001 Forest Gump C102 10002 Iron man C103 10003 Ender Game C101 Cat_id Type C101 Sci Fi C102 Drama C103 Action

3 If we have a new category, we can insert into category.
M_id Title Cat_id 10001 Forest Gump C102 10002 Iron man C103 10003 Ender Game C101 Cat_id Type C101 Sci Fi C102 Drama C103 Action C104 Cartoon

4 If we have a new category, we can insert into category.
If we change category type, we can do in category. 1 2 M_id Title Cat_id 10001 Forest Gump C102 10002 Iron man C103 10003 Ender Game C101 Cat_id Type C101 Sci Fi C102 Drama C103 Action & Advenger C104 Cartoon 2 1

5 Maintaining History of Time-Variant Data
Normally, existing attribute values are replaced with new value without regard to previous value Time-variant data: Values change over time Must keep a history of data changes Keeping history of time-variant data equivalent to having a multivalued attribute in your entity Must create new entity in 1:M relationships with original entity New entity contains new value, date of change

6

7 Fan Traps Design trap occurs when relationship is improperly or incompletely identified Represented in a way not consistent with the real world Most common design trap is known as fan trap Fan trap occurs when one entity is in two 1:M relationships to other entities Produces an association among other entities not expressed in the model

8

9

10 Supertype/subtype relationships

11

12 Disjoint and Overlapping Constraints
Disjoint subtypes Also called nonoverlapping subtypes Subtypes that contain unique subset of supertype entity set Overlapping subtypes Subtypes that contain nonunique subsets of supertype entity set

13 Overlapping subtypes

14 Completeness Constraint
Partial completeness Symbolized by a circle over a single line Some supertype occurrences are not members of any subtype Total completeness Symbolized by a circle over a double line Every supertype occurrence must be member of at least one subtype

15

16

17 Transforming the ER diagram into relation Schema diagram
The steps: Map regular entities Map weak entities Map binary relationships Map unary relationships Map ternary relationships Mapping Supertype/subtype relationships

18 Mapping a composite attribute

19 Looks like this using relational schema
Relational schema diagram : Relational schema : CUSTOMER( Custome_ID, Customer_Name, Street, City, State, Zip )

20 The 1:M Relationship Between PAINTER and PAINTING

21 Mapping a 1:M relationship

22 Looks like this using relational schema diagram

23 Mapping a binary 1:1 relationship
Some nurse is not in charge for care center  (0,1) All care centers must have a nurse to be in charge  (1,1) So,put FK on (0,1) care center

24 Looks like this using relational schema diagram

25 Mapping an M:M relationship

26 Mapping an M:M relationship

27 Looks like this using relational schema diagram

28 Mapping weak entities

29 Looks like this using relational schema diagram

30 Mapping Supertype/subtype relationships

31 Looks like this using relational schema diagram

32 Try this


Download ppt "ER example : movie & category"

Similar presentations


Ads by Google