Computer Science · Beginner
Databases & SQL
Store data so it stays correct, then ask it questions: keys, joins, indexes and transactions — the SQL every product is built on.

Computer Science program
- Lessons
- 6
- Study time
- 1h 55m
- Level
- Beginner
- Program
- Computer Science
Sign in to open the lessons
6 lessons
Lessons, files and narration open after you sign in and buy the program. One payment opens every course in it.
Sign in to open a lesson. Buying the program opens every course and lesson in it, permanently.
About this course
Almost every application is a database with a story around it. This course teaches how to store data so that it stays correct: tables and relationships, keys and constraints, and the schema decisions that are painful to change later.
You will learn SQL properly — selecting and filtering, sorting and paging, joining tables together, grouping and aggregating, and writing the slightly harder questions that real reports need. Then you will learn why some queries are fast and others are not: indexes, query plans, and transactions that keep money and records consistent.
The project is a school database that answers real report questions: which students are behind, which classes are over capacity, which fees are outstanding. You finish with a database you designed, not one you copied.
Who this is for
- You can write application code but freeze when the data needs a join.
- You analyse data in spreadsheets and have hit the ceiling.
- You are interviewing for a role where 'some SQL' is on the list.
Before you start
- Basic comfort with logic and the idea of a table of rows — no prior SQL needed.
- A laptop or desktop to run the practice database; the lessons include an online option.
- Six hours across a week.
Where it leads
- Backend Development with Node.js connects this database to an API.
- Data Structures & Algorithms explains the costs behind an index.
- SQL is asked for in almost every analyst, backend, QA and product job in Ghana, and it is checkable in an interview in ten minutes.
Tools you will use
What you will build
- 1A normalised schema with keys and constraints
- 2A set of queries from simple filters to multi-table joins
- 3Aggregate reports with grouping and ordering
- 4Indexes with before-and-after timings
- 5A school database that answers real report questions in a single query
Curriculum
2 modules · 6 lessons · 1h 55m
Sign in to open each lesson
01 · Talking to data
Tables, keys and the query language built on top of them.
1. Tables, rows and keys
A relational database is a collection of tables, and the whole design rests on one idea: each table stores exactly one kind of entity, each row is one instance of it, each column is one fact — and keys are what stop the rows from lying about each other. This lesson builds the relational model from scratch: domains and types, keys in all their forms, foreign keys and referential integrity, constraints as enforced truth, and how to model a small real system (a library) so that illegal states are unrepresentable. The schema is where data correctness lives; everything else is downstream.
2. SELECT, WHERE, ORDER BY
Almost every question you will ever ask a database comes down to three clauses: which columns (SELECT), which rows (WHERE), in what order (ORDER BY) — plus the filters' fine print, three-valued logic with NULL, and the operators that make predicates correct. This lesson works through the read side of SQL precisely: the logical order in which a SELECT is actually evaluated, the filter vocabulary, sorting and its collation surprises, paging, functions in predicates and when they break indexes, and the discipline of selecting only what you need. Query text is a description of a result; the engine decides how.
3. Joins: asking across tables
Data is split into tables so each fact is stored once — and every interesting question spans tables, which is what joins are for. This lesson covers the join types with their exact row-by-row semantics (INNER, LEFT, RIGHT, FULL, CROSS), outer joins and the "find what's missing" pattern, self joins and anti-joins, join correctness traps (fan-out, null keys, non-equi joins), and how to read a join in a plan. Normalisation stores the story in pieces; joins tell it whole again.
02 · Making it real
Writes, speed and correctness under concurrency.
1. Insert, update and delete safely
Reads may be frequent, but writes are where mistakes become permanent: a forgotten WHERE rewrites a table, a missing transaction splits one fact into two, a silent default invents data. This lesson covers DML precisely — inserting with defaults and conflict handling, updating with returning verification, deleting with intention, batch operations, the SQL injection boundary in parameterised statements, and the discipline of writing every write to touch exactly the rows you mean and to prove what changed. Safe writes are the difference between a database you trust and one you are afraid of.
2. Indexes and EXPLAIN
An index is a sorted side-structure the database maintains so it does not read a whole table to answer one question — and it is the single most effective tool for making a slow query fast. This lesson covers how B-tree indexes actually work, what they cost in writes and storage, the many kinds of index and when each applies, the predicate forms that can and cannot use one, composite index column order, and EXPLAIN ANALYZE as the instrument that turns tuning from folklore into measurement. Add indexes from queries, prove them with plans, and never index 'just in case'.
3. Transactions and constraints
Money, seats, inventory and grades are all *shared mutable state*, and two people acting at once will eventually collide. This lesson covers the ACID guarantees that make multi-statement writes safe, isolation levels and the anomalies each one permits, locking (`for update`, deadlock avoidance), constraints as the final backstop, and the application patterns — optimistic versions, idempotency, retry on serialization failure — that turn concurrency from a source of corruption into a solved problem. Correctness under concurrency is not an advanced topic; it is Tuesday.
6 lessons, including the a school database that answers real report questions in one query project. Sign in and buy the program to open them. Create an account to track progress and earn the certificate.
Taught by a working engineer
Ama Boateng — Data Engineer. Every lesson is written to be used, not just watched.
A verifiable certificate
Complete every lesson and you get a certificate with a code and QR that an employer can check in seconds.
Practice in the Code Lab
Write and run code in the browser while you learn, with your work saved to your own account.
Still have a question?
Email hello@codemasterghana.com or send a message from the contact page — we answer within two working days, in English or Twi.