Data and Databases Explained: Tables, SQL and Backups (Tech+)
What you’ll know
Why data is worth protecting, structured vs unstructured data, how a database table works (rows, columns, keys), the four SQL commands everyone meets, relational vs NoSQL, and how to back data up properly.
Why it matters. Every app you use, from a school’s grade system to a game’s leaderboard, is a front end on a database. Help desk staff are asked about lost data and slow reports constantly; knowing how the data is stored makes those tickets much easier.
Data has value
- Data turns into information once it’s organised (a list of sales becomes “best month: March”).
- Businesses use it to decide what to sell, whom to hire, what to fix. That’s why attackers steal it and ransomware locks it.
- Personal data (names, addresses, health, payment details) is protected by privacy laws, so losing it costs fines as well as trust.
Structured vs unstructured
| Type | What it looks like | Examples |
|---|---|---|
| Structured | Fits neatly into rows and columns | A spreadsheet of customers, a table of orders |
| Semi-structured | Has labels but no fixed table shape | JSON, XML, email headers |
| Unstructured | No predefined shape | Photos, videos, chat messages, PDFs |
How a database table works
| id | name | kind | age |
|---|---|---|---|
| 1 | Rex | dog | 4 |
| 2 | Mittens | cat | 2 |
| 3 | Biscuit | dog | 9 |
- Each row (a record) is one pet. Each column (a field) is one fact about it.
- The primary key (
id) is unique for every row, so two pets called Rex never get mixed up. - A foreign key is a column that points to another table’s primary key, for example an
owner_idpointing at an owners table. That link is what makes a database relational. - A schema is the plan: which tables exist and which columns and types each one has.
The SQL you’ll meet
| Command | Does | Example |
|---|---|---|
| SELECT | Read rows | SELECT name FROM pets WHERE kind = 'dog'; |
| INSERT | Add a row | INSERT INTO pets (name, kind, age) VALUES ('Rex', 'dog', 4); |
| UPDATE | Change rows | UPDATE pets SET age = 5 WHERE name = 'Rex'; |
| DELETE | Remove rows | DELETE FROM pets WHERE id = 2; |
An UPDATE or DELETE without a WHERE changes every row. That’s how real outages start.
Relational vs NoSQL
| Type | Stores data as | Examples |
|---|---|---|
| Relational (SQL) | Tables with fixed columns, linked by keys | MySQL, PostgreSQL, Microsoft SQL Server, SQLite |
| NoSQL: document | Flexible JSON-like documents | MongoDB |
| NoSQL: key-value | A key and its value, like a dictionary | Redis |
Flat files (a CSV or spreadsheet) are fine for small lists, but they don’t handle many people editing at once, and they can’t enforce rules like unique IDs. That’s the job of a database.
Backups: the 3-2-1 rule
- 3 copies of anything that matters (the original plus two backups)
- on 2 different kinds of storage (say, the PC plus an external drive)
- with 1 copy off-site or in the cloud, so a fire, theft or ransomware can’t take all of them.
A full backup copies everything; an incremental copies only what changed since the last backup. Whatever you use, test a restore now and then: a backup you’ve never restored is only a hope.
Steven’s backup plan used to be “it’s on the desktop.” Three copies, two kinds of storage, one off-site. Not three folders called Final, Final2 and FINAL-real. — Nyx
Try it: a real database in 10 lines
Python includes SQLite, a small database that lives in one file. Save this as pets.py:
import sqlite3
db = sqlite3.connect("pets.db")
db.execute("CREATE TABLE IF NOT EXISTS pets (id INTEGER PRIMARY KEY, name TEXT, kind TEXT, age INTEGER)")
db.execute("DELETE FROM pets")
db.executemany("INSERT INTO pets (name, kind, age) VALUES (?, ?, ?)",
[("Rex", "dog", 4), ("Mittens", "cat", 2), ("Biscuit", "dog", 9)])
db.commit()
for row in db.execute("SELECT name, age FROM pets WHERE kind = 'dog' ORDER BY age"):
print(row)
print(db.execute("SELECT COUNT(*) FROM pets").fetchone())
PS> python pets.py ('Rex', 4) ('Biscuit', 9) (3,)
It creates pets.db, makes a table with a primary key, inserts three rows, then runs a SELECT for the dogs sorted by age and a COUNT of all rows. The DELETE FROM pets line empties the table first so you get the same result every run. On Linux or WSL use python3 pets.py. Try changing the query to WHERE age > 3.
Where this fits
This is part of the free CompTIA Tech+ roadmap: computer basics in the order the exam teaches them.
NextStrong passwords and passphrases→
Go deeper
- Programming basics — the Python used above
- Operating systems and file systems — where the database file lives
- Backup and restore drill (Linux) — a hands-on 3-2-1 style restore
Explainer, written by StashGrid with AI help and checked against the CompTIA Tech+ (FC0-U71) exam objectives before publishing. Every command was run on a Windows 11 PC and in Ubuntu 24.04 (WSL) on 30 Oct 2026. StashGrid isn’t affiliated with CompTIA. Spotted an error? Tell us.