Entity Relationship Diagrams. Entities An entity is something about which the system/business needs...
-
Upload
laurence-lloyd -
Category
Documents
-
view
212 -
download
0
Transcript of Entity Relationship Diagrams. Entities An entity is something about which the system/business needs...
![Page 1: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/1.jpg)
Entity Relationship Diagrams
![Page 2: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/2.jpg)
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
![Page 3: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/3.jpg)
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
![Page 4: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/4.jpg)
Example
Student
.Last name
.First name
Address
.Street address
.Town
.County
.Post code
![Page 5: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/5.jpg)
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
![Page 6: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/6.jpg)
Example
• A current STUDENT is ENROLLED ON one or more SUBJECTS
• A SUBJECT is STUDIED BY none (zero), one or more students
STUDENTSUBJECT
Is enrolled on
Is studied by
Verb phrases are used for relationships
![Page 7: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/7.jpg)
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
![Page 8: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/8.jpg)
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
![Page 9: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/9.jpg)
Cardinality symbols
• Cardinality interpretation
Exactly one (one and only one)
Minimum instances 1
Maximum instances 1
or
![Page 10: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/10.jpg)
Cardinality
• Cardinality interpretation
Zero or one
Minimum instances 0
Maximum instances 1
![Page 11: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/11.jpg)
Cardinality
• Cardinality interpretation
One or more
Minimum instances 1
Maximum instances many (>1)
![Page 12: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/12.jpg)
Cardinality
• Cardinality interpretation
Zero, one or more
Minimum instances 0
Maximum instances many (>1)
![Page 13: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/13.jpg)
Cardinality
• Cardinality interpretation
More than one
Minimum instances >1
Maximum instances >1
![Page 14: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/14.jpg)
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
![Page 15: Entity Relationship Diagrams. Entities An entity is something about which the system/business needs to store data. Entities are drawn as rectangles The.](https://reader036.fdocuments.net/reader036/viewer/2022083005/56649f265503460f94c3ccd9/html5/thumbnails/15.jpg)
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