The environment
Find your way around Harbour Mutual's database: run your first queries, and create and fill a table of your own.
Theory for today: How an insurer works, Relational databases.
The lesson
A database holds tables; a table holds rows, one per thing (a customer, a policy, a claim), and columns, one per fact about it. You talk to the database in SQL. Harbour Mutual's eleven tables are described on the data model page.
Everything here runs in PostgreSQL in your own browser: nothing you do affects anyone else, and Reset in the playground brings the original data back.
Reading a table
SELECT *
FROM products;
* means every column. Press Run, or Ctrl+Enter.
SELECT *
FROM customers
LIMIT 5;
LIMIT shows only the first rows: useful on a big table.
SELECT COUNT(*)
FROM policies;
COUNT(*) counts rows instead of showing them.
Creating and filling a table
CREATE TABLE makes a table; each column has a name and a type, such as TEXT, DATE or NUMERIC. A primary key is a column whose value identifies each row, so it must be unique.
CREATE TABLE notes (
note_id SERIAL PRIMARY KEY,
written DATE DEFAULT DATE '2025-12-31',
note TEXT NOT NULL
);
INSERT INTO notes (note) VALUES ('My first table');
SELECT * FROM notes;
SERIAL numbers the rows for you; DEFAULT fills a column you leave out.
Briefs from the business
0 of 4 done
Write SQL to answer each brief, run it, then check your answer against Harbour Mutual's. Your database is the same one as in the playground.
Starting PostgreSQL in your browser…
Brief 1.1 · What does Harbour Mutual sell?
The new head of analytics wants to see every product Harbour Mutual sells, with all their details.
Tables: products
Brief 1.2 · How many customers?
How many customers does Harbour Mutual have? Answer with a single number.
Tables: customers
Brief 1.3 · A watchlist of claims
The claims team wants a small table of its own, watchlist, to track claims they are looking into. It needs three columns, in this order: claim_number (text, the primary key), reason (text) and added_on (a date, which should be 31 December 2025 unless given).
Tables: watchlist (yours)
Brief 1.4 · Put two claims on the watchlist
Add two claims to your watchlist: CL-2024-00522, the largest fire of 2024, with the reason 'Large loss review', and CL-2025-01525, a collision still open at year end, with the reason 'High reserve'. The watchlist should hold exactly these two.
Tables: watchlist (yours)