Presentation is loading. Please wait.

Presentation is loading. Please wait.

Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.

Similar presentations


Presentation on theme: "Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The."— Presentation transcript:

1 Entity Relationship Diagrams

2 Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The rectangle represents all instances of the named entity Important to distinguish between an entity and its instances

3 Attributes Entity is something about which we want to store data Specific items of data we want to store are data attributes To record attributes of the entity we list them within the entity shape

4 Example Student.Last name.First name Address.Street address.Town.County.Post code

5 Relationships Entities and attributes do not occur in isolation. The things they represent interact with and impact one another to support the business A relationship is a natural business association that exists between one or more entities

6 Example A current STUDENT is ENROLLED ON one or more SUBJECTS A SUBJECT is STUDIED BY none (zero), one or more students STUDENT SUBJECT Is enrolled on Is studied by Verb phrases are used for relationships

7 Cardinality The previous example shows the complexity or degree of each relationship Must there exist an instance of STUDENT for each instance of SUBJECT – No Must there exist an instance of SUBJECT for each instance of STUDENT – Yes How many instances of STUDY can exist for each instance of STUDENT – Many How many instances of STUDENT can exist for each instance of STUDY - Many

8 Cardinality continued Cardinality defines the minimum and maximum number of occurrences of one entity that may be related to a single occurrence of the other entity All relationships are bidirectional therefore cardinality must be defined in both directions for every relationship

9 Cardinality symbols Cardinality interpretation Exactly one (one and only one) Minimum instances 1 Maximum instances1 or

10 Cardinality Cardinality interpretation Zero or one Minimum instances 0 Maximum instances1

11 Cardinality Cardinality interpretation One or more Minimum instances 1 Maximum instancesmany (>1)

12 Cardinality Cardinality interpretation Zero, one or more Minimum instances 0 Maximum instancesmany (>1)

13 Cardinality Cardinality interpretation More than one Minimum instances >1 Maximum instances>1

14 Cardinality Cardinality tells us the following rules about the data we want to store: When we insert a STUDENT instance in the database we must link that student to at least one instance of SUBJECT A STUDENT can study more than one SUBJECT and we must be able to store data that includes all SUBJECT(s) for a given STUDENT

15 Cardinality We must insert a SUBJECT before we can link (associate) STUDENTS to that SUBJECT. This is why SUBJECT can have zero students – no students have yet enrolled on that subject. Once a SUBJECT has been inserted into the database, we can link (associate) many STUDENTS with that SUBJECT


Download ppt "Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The."

Similar presentations


Ads by Google