Skip to content

What is a Database?

1 min read3 lessons in topic

Learning objective

By the end of this lesson you will be able to explain what a database is, the table model and why it beats spreadsheets.

A database is an organised collection of data that can be stored, queried and updated efficiently. Most web applications rely on one.

Why not just a spreadsheet?

  • Scale — databases handle millions of rows
  • Concurrency — many users at once without corruption
  • Integrity — rules prevent invalid data
  • Querying — powerful, fast searches

The relational model

Data is organised into tables. A table has columns (fields) and rows (records). Each row is one item — for example, one student.

CREATE TABLE students (
  id INT PRIMARY KEY,
  name VARCHAR(100),
  programme VARCHAR(100)
);

Primary keys

A primary key uniquely identifies each row — in the example above, id. No two rows may share the same key.

DBMS examples

  • PostgreSQL — open source, used by this department site
  • MySQL — very popular on the web
  • SQLite — a lightweight file-based database

Practice exercise

Design a courses table with columns for id, title and credits. State which column is the primary key.

Check your understanding

1. What is a primary key?

2. Which of these is a database management system?

Self-graded — answer then check below.