Here is the definition of an entity.
An entity represents a thing that has meaning in a given context and about which there is a need to record data.
A data model is not concerned with the individual entities. Instead, it describes particular types of entity. For example, all students are represented by the same types of data (student identifier, name, whether or not registered, and region). Therefore, we simply record the Student entity type that defines the properties common to the collection of all students:
Student (Studentid, Name, Registered, Region)
Thus Student is the name of an entity type with properties of student identifier (named Studentid), student name (Name), whether registered or not (Registered) and location (Region).
An entity type is given a meaningful name for future reference. In this example, there are five entity types: Staff, Student, Course, Enrolment and Assignment. Thus an entity type is a convenient device for representing what we know about the actual entities themselves. Table 5 contains six entities of type Student (each column is headed with the name of a particular property – also known as an attribute).
Table 5 Some entities of the entity type Student
Entity types are represented on an E–R diagram as a box containing the name of the entity type.
An attribute (property) is a component of an entity type that represents a single property of the entities of that type.
Thus Studentid, Name, Registered and Region are the attributes of the Student entity type. Note that the term ‘attribute’ is a type concept, but it has become conventional to use the term ‘attribute’ rather than ‘attribute type’.
The values in a table such as those in Table 5 above are known as occurrences or instances of a particular attribute. So, S01 is an occurrence of the attribute Studentid, and Gillies is an occurrence of the attribute Name.
An important E–R data modelling characteristic is that there is a specific way to distinguish entities of the same type, from one another, by using the idea of an identifier. An identifier is a particular attribute with the property of uniqueness, such that no two entities of the same type have the same value for that attribute. For example, the attribute Studentid is the identifier for the Student entity type and the attribute CourseCode is the identifier for the Course entity type. When it is not possible to find a single attribute with the uniqueness property, a combination of attributes is used as an identifier. For example, the two attributes Studentid and CourseCode together form an identifier for the Enrolment entity type. When we write entity types as we did above, it is conventional to underline an attribute that comprises the identifier.
There are three roles for an identifier and they are as follows.
As an assertion of existence. An occurrence of the Student entity type with the value S02 for its identifier is an assertion that a student exists and is registered with that student identification number.
As a reference. An identifier such as S02 refers uniquely to a specific student; given this identifier, we can examine the above table to discover that the student with this identifier is named Thomson.
As a constraint. No two students can have the same identification number.