This weekend I got an assignment that sounded simple on paper: build a small school database for a fictional secondary school called Greenwood Academy, fill it with data, and then write a bunch of queries against it. Three tables. Thirty questions. Easy, right?

It was not "easy," but it was one of those exercises where you can actually feel yourself understanding SQL instead of just copying syntax from a tutorial. Here's what the process looked like, and a few things that tripped me up along the way.

Setting up the database

I'm using PostgreSQL hosted on Aiven, with DBeaver as my SQL client. The first step was creating a schema basically a named container to keep all of Greenwood Academy's tables separate from anything else in the database:

CREATE SCHEMA greenwood_academy;