Collecting Data from Databases
Kettle & Crumb's till does not save a spreadsheet. Every sale goes straight into a database, alongside the menu and the loyalty list. When Nisha asks for June's cold-coffee sales, the analyst's first job is to get exactly those rows out, reliably, and in a way that can be repeated next month.
The rule
Ask the database for exactly the rows and columns you need.
A relational database stores data in tables that link to each other through keys:
orders(order_id, order_date, customer_id, item_code, qty, amount)menu(item_code, item, price)customers(customer_id, name, joined)
orders.item_code points to menu.item_code, so item names are stored once in menu rather than copied into every order. You pull data out with SQL, a language for asking questions of tables:
SELECT order_date, item_code, qty, amount
FROM orders
WHERE item_code = 'C01'
AND order_date >= '2025-06-01'
AND order_date < '2025-07-01';SELECTnames the columns you want.FROMnames the table.WHEREkeeps only the rows that pass every condition.
When you need a name from another table, a JOIN matches rows on their shared key, just as VLOOKUP did on a sheet:
SELECT o.order_date, m.item, o.qty
FROM orders AS o
JOIN menu AS m ON m.item_code = o.item_code;Analysts normally get read-only access, often to a copy of the live database, so a mistake cannot damage the till's records.