- An entity is simply a person, place, event or thing for which we want to collect data.
- Example: student, course, teacher, enrollment, band, singer (has to be single!)
- An Entity in an ERD is slightly different, we are referring to all of the objects as a whole collection.
- For example if we had a student entity, we are talking about all the students together not just a single one.
- An entity is represented by a rectangle containing its name.
- things a clear identity of its own.
- something that exists separate from other things and has a clear identity of it own.
- each entity must have at least one primary key.
entity
Attribute
- Attributes are the characteristics of an entity, they are the actual pieces of data that will be in the database.
- Example of student attribute: student number, first name, last name, date of birth and nationality and so on.
- In ERD, attributes are represented by oval and are connected to an enity with a line, Each oval contains the name of the attribute it represents.
- Each attribute should be connected to only one entity.
attributes
multi-valued attribute:
An attribute that holds multiple values for a single entityExample: A person may have more than one email address.
derived attribute:
an attribute that represents a value that is calculated from the value of another attribute within the same entity.Example: A person's age. This is calculated from date of birth and the current date.
composite attribute:
An attribute composed of multiple values each with an independent existence but together provides one information.Example: Address. This can be subdivided into street, suburb, state and postcode.
Relationship
- Entities in the ERD are related to each other. Some are joined together to show that there is some sort of relationship between the entities.
- Example: The teacher and student entity have a relationship that can be labelled as "teacher teaches student"
- Relationships are represented by a diamond shaped symbol with a word in the shape to describe the relationship.
- Lines are used to connect the entities and relationships to one another.
Relationship Types:
- The relationship type or degree refers to the number of entities involved in the relationship.
- There are 3 basic relationship associations:
- Unary relationship : The entity is related to itself
- Binary relationship: Two entities are rlated to each other
- Ternary relationship : three entities are related to each other
- There are higher ones but they are very uncommon.
- The most common one is the Binary relationship.
Connectivity
- This describes how many objects of one entity is related to how many objects in the other entity in the relationship.
- There are three types of relationship connectivity:
- One to One (1 to 1) : each object in the first entity is related to one other object in the other entity.
- One to Many (1 to M) : one object in the first entity is related to many objects of the other entity. this can also be Many to One, depending which entity is drawn on which side.
- Many to Many(M to N): many objects of the first entity is related to many objects in the other entity.
Participation
- This describes whether in a relationship if one or both of entities are required for the other to exist.
- There will be some cases that one entity can exist even without the other enrity.
- Example: in a relationship between teachers and classes, the class has a total participation in the relationship. Every instance of the class requires a teacher.
- Total participation is drawn with a double line.
No comments:
Post a Comment