An entity is a person, place, thing, event or concept of interest to the business or organisation about
which data is to be stored. For example, in a school, possible entities might be PUPIL, CLASS and
TEACHER. An entity is implemented as a table.
Entity occurrence:
A specific example of an entity is called an instance or entity occurrence. For example, 001, John Smith,
5/7/2010, 4F1 would be an example of an entity occurrence found in the PUPIL entity.
Attribute:
An entity is described by its attributes. Each attribute is a characteristic of the entity. For example, attributes of the PUPIL entity would include pupilID, forename, surname, DOB and regClass. An attribute is implemented as a field.
Primary key:
An attribute or combination of attributes that uniquely identifies one, and only one, entity occurrence is called a primary key. For example, the primary key of the PUPIL entity would be pupilID. A primary key is
signified by underlining in the entity-relationship diagram. The primary key must be unique and not empty (entity integrity).
Foreign key:
A foreign key is an attribute in one table that uniquely identifies a row of another table. It is signified by an asterisk. The attribute refers to the Primary Key of another entity and used to link tables. A FK must
already exist as a PK in another table and not be empty. (Referential Integrity)
Compound key:
A compound key is a primary key that comprises two or more attributes. Each attribute that makes up a
compound key is a primary key in its own right. For example, the primary key of the CLASS entity would
be the compound key formed by combining classID + staffID + subject. In this example, staffID would be
the primary key of the TEACHER entity and subjectID would be the primary key of the SUBJECT entity.
In some entities, no one attribute can be used as a primary key. One solution is to use a combination of two or more attributes to create a unique identifier. This is known as a compound key.
A relationship is a natural association between one or more entities. For example, pupils learn subjects and teachers educate pupils.