Level 5 · Databases and Data Management · Course 5.2 SQL
Module 55: SQL Fundamentals
Goal: write SQL to create tables, add, read, change and remove data, filter and sort results, and summarise data with simple calculations.
You'll need: DB Browser for SQLite and your crm.db with sample data from Module 54. (The SQL here works in SQLite
and PostgreSQL; differences are noted.)
Lessons
- 1What SQL is15–25 minutes✓
- 2Creating and changing tables15–25 minutes✓
- 3INSERT, UPDATE and DELETE15–25 minutes✓
- 4SELECT, filtering and sorting15–25 minutes✓
- 5Counting and summarising15–25 minutes✓
🛠️Module practice: Project B, part 1, everyday SQL
Using crm.db, write and save in queries.sql (with a comment above each):
- Insert 10 more customers, 5 products and 20 orders with items (generate realistic fake data with AI, and read it).
- Update and delete using the SELECT-first habit.
- Five filtering and sorting queries a CRM user would ask.
- Five summary queries: totals, averages, counts per group.
Commit queries.sql.
✅Module check
Explain in a few sentences, in your own words:
What are the main SQL statements, and what's the most important safety habit when changing data?
Show a good answer
A good answer mentions: CREATE/ALTER/DROP define tables; INSERT adds rows, UPDATE changes them, DELETE
removes them; SELECT reads, with WHERE to filter, ORDER BY to sort, LIMIT to cap results, and aggregates like
COUNT, SUM and AVG with GROUP BY to summarise. The key safety habit: always use WHERE on updates and deletes,
run the matching SELECT first to check which rows are affected, and use transactions and backups for important changes.
📝Module quiz
10 questions · 10 marks each · 100 marks in all · pass mark 70% · retry as often as you like ·
