MyLeoNes™

Databases and queries — Computing, 14–17 years

How large collections of organised information can be stored, connected and questioned without reading every record by hand.

Idea

A database stores organised facts so a program can find and update them reliably. Information is often split into tables: one for people, another for orders, with an ID linking related rows. A query is a precise question, such as asking for every order made by one person.

Why it matters

A few records fit in a spreadsheet, but millions need a system that avoids repetition and keeps related facts consistent. Databases grew from this problem in businesses, libraries and other services that had to share and update information. Queries let people ask for useful subsets instead of copying everything.

Worked example

A table Orders has rows (Ana, 12), (Rui, 7), and (Ana, 4), where each pair is a name and amount. To find Ana’s orders, filter rows whose name equals Ana: keep 12, skip 7, keep 4. To find the total, add the kept amounts: 12+4=16.

Common trap

A reasonable mistake is to put every fact into one enormous table, because seeing everything together feels clearer. Repeated names and addresses then appear in many rows, and one update can miss a copy. Splitting tables and linking them with IDs may look less familiar, but it reduces contradictions and repeated work.

Where it appears

Online shops use databases for products, customers, stock and orders. A library catalogue queries titles, authors and available copies, while a school platform retrieves the records a particular user is allowed to see. Good database design also helps prevent one person’s private information appearing in another person’s results.

Keep exploring

Other languages

Loading MyLeoNes™…