Entities

Entities

Anything about which data is stored is called an entity.

There is a standard way of writing down the design of an entity:

The entity name is shown in capital letters, followed by the fields in brackets. The key field is identified by underlining it.

Example :

PUPIL (PupilNum, Name,  DOB)

Any foreign fields would be shown in italics (or overlined).

A foreign field is a keyfield from another table - and provides a link between the two tables.

Example :

PUPIL (PupilNum, Name, DOB, ExamNum)
EXAM (ExamNum, Level, Subject, Date)

 

 
Entity Relationship Diagrams

An entity-relationship diagram shows the links between tables.

These relationships can be...

One-to-one
 Eg Products in a supermarket each have a unique barcode number.

One-to-Many
Eg A video club member may hire out a number of videos.

Many-to-Many
Teachers and pupils in a school. Each teacher teaches many pupils and each pupil has many teachers.