Data becomes useful when we can say what each value means and how it was collected. A neat table can still produce a wrong conclusion if its entries are inconsistent or incomplete. We will use a fictional reading log, so no personal information is needed.
9.1 From entries to a useful table
A table has rows and columns. Each row can be a record, such as one reading session. Each column is a field, such as date, title, or minutes. A field also has a kind of value: a date is not free-form prose, and minutes should be a number if we want to add them.
| session_id | date | title | minutes |
|---|---|---|---|
| 1 | 2026-10-01 | River Book | 20 |
| 2 | 2026-10-02 | River Book | 35 |
| 3 | 2026-10-03 | Night Map | 15 |
The session_id identifies a row even when two rows share a title or date. Before collecting fields, ask what question you want to answer. If you only need total minutes, a reader’s home address adds no value and creates a privacy burden.
A blank minutes cell means the value is missing. It does not automatically mean zero minutes. If you treat missing as zero, an average can fall even though no one has reported a zero-minute session. Decide how to handle missing data and explain that decision when you report a result.
Check. Are the two River Book rows duplicates? Answer: Not from the table alone. They have different dates and identifiers and could be two real sessions. A repeated row is not the same as a repeated title.
9.2 Cleaning, filtering, and summarizing
Suppose another row says 30 min in the minutes field, one says 0.5 hours, and a third says -10. A spreadsheet may treat the first two as text and add neither, even though a person can understand them. The negative value may be a correction or an error; you cannot know without more context. Cleaning means checking and recording how you resolve such problems, not quietly changing values to fit a calculation.
Filtering selects rows that meet a condition, such as dates in October. Sorting changes their order. Summarizing reduces many rows to a count, total, or average. For the three valid rows above, total minutes are 70 and the average is about 23.3 minutes per session. If someone reports “average reading time rose,” ask whether the mix of people or sessions changed. A correct calculation can still mislead when it answers a narrower question than the headline suggests.
Try it. Add a fourth row with a blank minutes field. Compute the average of known session lengths, then compute the average after treating blank as zero. The first is about 23.3; the second is 17.5. Neither is automatically the answer to “What happened in the missing session?”
9.3 Why databases exist
A spreadsheet is useful for a small, personal table. A database helps when many records, relationships, or users must be managed together. One table might hold books, another reading sessions. A book identifier connects a session to its book without copying the full title into every row. This reduces inconsistent spelling and makes updates easier.
When two people edit the same record, the system needs rules about whose change wins or whether one edit should be rejected. A transaction treats related changes as a unit. For example, moving a book from one shelf to another may need both an old assignment removed and a new one added. If only half succeeds, the data can become inconsistent. Databases provide tools to prevent that kind of partial change, though application design still matters.
Check. Does putting data in a database make it correct? Answer: No. A database can enforce some rules and coordinate changes, but it cannot know whether a reader entered the wrong date or invented a session.
9.4 Asking a precise question
A query asks a database for data that meets conditions. You can read this SQL without running it:
SELECT title, minutes
FROM sessions
WHERE minutes >= 20
ORDER BY minutes DESC;
It selects two fields from sessions, keeps rows with at least 20 minutes, and shows longer sessions first. The query does not calculate an average, check whether a title is honest, or decide what to do with missing values. It answers exactly the question written.
CSV is a simple format for rows and columns; JSON can express nested values and is common in web applications. Both make data exchange possible, but a file format does not settle permission, privacy, or retention. Collect only what is needed, limit access, and decide when data should be deleted. Export options matter if people may need to move their own data later.
Module activity. Take the fictional table and add one blank duration, one repeated-looking row, and one duration in hours. Write down which entries you can safely convert, which need a question to the source, and which answer you can still calculate honestly. Explain your handling of missing values.
Check. Why might two copies of the same title be valid? Answer: A reader can have multiple sessions for one book. A unique session identifier distinguishes the records.
Next we will see how data, code, and an interface become a service people can use.