Computer science
Tables & databases
Organising data in rows and columns so a computer finds in seconds what would take you hours of flipping pages.
What you need first
Your timetable, the leaderboard in your favourite game, the contact list on your phone: these are all tables. As soon as a table grows too big for any human to keep track of, a database takes over. It stores millions of entries and still finds exactly the one you are looking for in the blink of an eye.
Rows and columns
A table organises data in rows and columns. Each row is one entry, for example a student, a product or a song. Each column is one property, for example name, price or length. So that no entry is ever confused with another, every row gets a unique number, much like an index in a list: number 47 exists exactly once, no matter how many people share the same name. Experts call this number the key of the row.
Counting starts at 0.
Searching and filtering instead of flipping pages
The real trick of a database: you never flip through the pages yourself. You ask a question like 'show me all books with fewer than 200 pages', and the database returns only the matching rows. That is called filtering. Filters can be combined: first all songs in the rock category, then only those from 2020 onwards. Out of millions of rows, you are left with the small list you actually need. To make this so fast, the database builds an index for important columns, much like the index at the back of a book. It then does not have to look at every single row.
Databases are everywhere
Your school stores grades and absences in a database. An online shop stores products, prices and orders in several tables connected through numbers: your order only remembers the product number, not the whole product description. And when a streaming service suggests shows to you, it is filtering its huge database for what you might like.
Exercises
0 of 6 solvedTime to try it yourself. You can't break anything, every attempt counts.
In a table of songs, each song has its own row. What goes in a column?
A table has 5 columns and 8 rows. How many cells (fields) does it have in total?
In a student table there are two students both called Max Meier. How does the database still tell them apart?
Match each database term to the explanation that fits.
The rows of a table are numbered from 1 upwards without gaps, and every new entry gets the next higher number. The table has 57 rows and you add one entry. Which number does it get?
So that two students with the same name are never confused, every row gets a unique ….
Where this leads