Chapter 9

Database Concepts

A database stores data in organised tables of records and fields, using a primary key to identify each record uniquely.

What is a database?

A database is an organised collection of data stored so it can be searched, sorted and updated efficiently. IGCSE work uses a single-table (flat file) or a relational database. Data is held in a table made of records (rows) and fields (columns). One record holds all the data about a single item, and one field holds one attribute for every record.

Keys and field types

A primary key is a field whose value is unique for every record, so it can identify one record with no confusion, for example a StudentID. In a relational database a foreign key is a field in one table that links to the primary key of another table. Each field is given a data type such as text, integer, real, Boolean or date/time, which controls what may be stored.

Key idea

Record = one row (all data about one item). Field = one column (one attribute). Primary key = a field that is unique for every record.

Why use a database?

Storing data in a database lets you search and sort thousands of records in seconds, update or delete a record in one place, and validate entries using the field data type. This is far faster and more reliable than paper records.

Example

In a table Students(StudentID, Name, Class, DateOfBirth), StudentID is the primary key. Two learners may share the name "Ali", but no two share a StudentID, so a search on StudentID always returns exactly one record.

Stuck on this topic? A verified JomKelas tutor can walk you through it.

Find a verified tutor