A-Level Computer Science / Unit 8: Relational Databases and SQL

8.1.2 Tables, Records and Attributes

🔒 Lesson slides are available to signed-in users. Sign in

8.1.2 Tables, Records and Attributes

A relational database represents real-world data using structured tables. This lesson develops the vocabulary needed to describe those tables precisely before keys, relationships and referential integrity are studied in the next section.

By the end of this section, you should be able to:

  • Distinguish between an entity and an individual instance of that entity.
  • Identify a relation, tuple, attribute and attribute value in a relational table.
  • Connect the formal terms tuple and attribute with the common terms record and field.
  • Explain why each cell should normally contain one atomic value.
  • Interpret and write a simple table definition using relational notation.

From Real-World Objects to Relational Tables

A database begins with the things, people, events or transactions that an organisation needs to describe. In database design, one category of real-world object is called an entity. Data about that entity can then be organised into a table.

Entity: a category of object, person, place, event or transaction about which data need to be stored.

Consider a robotics competition. The organisers need to store data about every robot entered in the event. Robot is an entity because the system will store multiple robots that share the same kinds of data.

Relation: a structured table in the relational model.
Relational database: a collection of relations used to store connected data.
Exam tip: In everyday language, people usually say table. In a question about the relational model, relation is the more formal term.

Entities and Entity Instances

An entity is the general category. An entity instance is one particular example of that category. Each instance normally becomes one row in the table.

Entity Possible instance Data that might describe it
Robot Robot R-204 Name, mass, inspection date and readiness status
Team Team T-17 Team name, school and coach
Match Match M-083 Round, start time and arena
Common mistake: An entity is not one particular object. Robot is an entity; Robot R-204 is an instance of that entity.

The Anatomy of a Relational Table

The relation below stores one tuple for each robot. The headings describe the same properties for every tuple, while each body cell contains an attribute value.

RobotID RobotName MassKg InspectionDate Ready
R-204 Aster 11.8 2027-09-12 TRUE
R-219 Orbit 9.6 2027-09-13 FALSE
R-231 Mosaic 12.4 2027-09-13 TRUE
Table part Database meaning Example above
Whole table One relation representing an entity Robot
One column One attribute shared by every instance MassKg
One row One tuple describing one instance The row for R-219
One cell One attribute value for one instance 9.6

Formal and Common Terminology

Database questions may use formal relational terminology or more familiar terms. Students should recognise both and use them accurately.

Formal term Common term Meaning
Relation Table The complete two-dimensional structure for one entity.
Tuple Record One row containing data about one entity instance.
Attribute Field or column One named property recorded for every tuple.
Attribute value Field value The value stored where one tuple and one attribute meet.
Tuple: a row that stores data about one instance of an entity.
Record: the common term for a tuple.
Attribute: a named property represented by a column.
Field: a common term often used for an attribute or for the value stored in it, depending on context.
Vocabulary caution: Some software documentation uses field for a column, while other contexts use it for one value inside a record. In exam explanations, make your meaning clear by referring to the column or the stored value.

One Cell, One Atomic Value

A well-formed relational table normally stores one atomic value in each cell. Atomic means that the value is treated as one indivisible item for the purpose of the database design.

Example entry Atomic? Reason
RobotName = Aster Yes The cell contains one robot name.
InspectionDate = 2027-09-12 Yes The date is treated as one value.
SensorTypes = infrared, ultrasonic No The cell contains a list of two separate sensor types.
CoachEmails = [email protected]; [email protected] No Two separate email values have been packed into one cell.

Lists inside a cell are difficult to search, validate and update consistently. A later design stage may place repeated values in another related table instead.

Common mistake: Atomic does not necessarily mean “cannot be split into characters”. A date may contain a year, month and day but can still be treated as one database value when the design uses a date data type.

Writing a Table Definition

A compact table definition places the relation name first and lists its attributes inside brackets:

Robot(RobotID, RobotName, MassKg, InspectionDate, Ready)

This notation describes the logical structure rather than the current data. It tells us which attributes exist, but it does not list the robot tuples stored at a particular moment.

Part of the notation Meaning
Robot The relation name
RobotID, RobotName, ... The attribute names
The brackets The boundary of the attribute list

The order in which rows are displayed is not part of their meaning. Similarly, changing the visible order of columns does not change which attributes belong to the relation. A query can choose and order the output when data are retrieved.

Exam tip: When asked to identify a tuple or attribute, quote a precise example from the table and state whether it is a row or a column.

Interactive: Table Anatomy Explorer

Select a concept to highlight the matching part of the Robot relation. The final mode checks whether example cells contain one atomic value.

Choose what to inspect

Entity: Robot

The complete table is the Robot relation.

RobotID RobotName MassKg InspectionDate Ready
R-204 Aster 11.8 2027-09-12 TRUE
R-219 Orbit 9.6 2027-09-13 FALSE
R-231 Mosaic 12.4 2027-09-13 TRUE

Explanation

A relation is the complete structured table used to represent one entity.

Common Mistakes and Misconceptions

  • Calling one robot an entity instead of an entity instance.
  • Reversing tuple and attribute: a tuple is a row; an attribute is a column.
  • Using record and field without stating whether a row, column or individual value is meant.
  • Thinking a relation is simply any table drawn in a document.
  • Assuming that a cell containing a comma-separated list still stores one atomic value.
  • Confusing the table definition with the tuples currently stored in the table.

Practice

Try these original questions

  1. Define entity and give one possible instance of the entity Vehicle.
  2. Explain the difference between a relation and a tuple.
  3. State the formal database terms for a record and a field represented as a column.
  4. In Sensor(SensorCode, Location, ReadingUnit, Active), identify the relation and its attributes.
  5. A row stores: S-44, Greenhouse 2, °C, TRUE. Explain what this row represents.
  6. Explain why ContactNumbers = 186..., 139... is not an atomic value.
  7. Rewrite the following as relational notation: a table called Delivery with the fields DeliveryNo, DateSent, Destination and Delivered.
  8. Explain why reordering the displayed tuples does not change the logical meaning of a relation.

Review

Term Meaning Example from Robot
Entity A category of thing about which data are stored Robot
Relation / table The complete structured table for the entity The Robot table
Tuple / record One row for one entity instance The row beginning R-219
Attribute / field A named property represented by a column MassKg
Attribute value One stored value for one tuple and attribute 9.6
Atomic value One indivisible value for the chosen design 2027-09-13
Next step: Section 8.1.3 explains how primary, candidate, secondary and foreign keys identify tuples and connect relations.