Video lessons
Live query demonstrations in pgAdmin, each starting with a request from a colleague, followed by three "Try these" tasks.
Course 3 of 6 · The Data Analytics pathway
Queries, Joins & KPIs in PostgreSQL
Learn SQL by answering practical business questions. Query a PostgreSQL database, filter and summarise data, join tables, and use subqueries and window functions to investigate questions from the fictional Kettle & Bean team.
Free preview lesson
What you will learn
PostgreSQL and pgAdmin are both free. Section 1 guides you through installing and setting them up, so you can get started without preparing your environment in advance. A setup and troubleshooting guide is included. No previous SQL experience is needed.
What's included
Live query demonstrations in pgAdmin, each starting with a request from a colleague, followed by three "Try these" tasks.
A written companion to every section, so you can review the queries and ideas at your own pace.
Short checks at the end of each section to confirm you have understood the key ideas.
Challenge briefings to work through on your own, then a solution walkthrough to compare your query with.
Sales, customer and returns data from the fictional company, ready to load into PostgreSQL.
Step-by-step help installing PostgreSQL and pgAdmin, plus fixes for common setup problems.

Inside the handbook
Each section has its own handbook with the notes, analogies, every example query with its real result, and space for your answers. Type in the fillable PDF or print it.
Shown: the Section 6 cover and the Lesson 6.1 page on INNER JOIN.
Course content
Set up PostgreSQL and pgAdmin, understand databases and tables, and write your first SQL queries.
Make query results easier to understand by renaming columns and shaping output.
Filter data using conditions to find records relevant to a business question.
Calculate new values, work with text and dates, and round results appropriately.
Use aggregate functions to calculate totals, counts, averages and other business measures.
Connect related tables to combine information and answer questions across a database.
Use subqueries to answer more complex questions and analyse results from multiple steps.
Use window functions to rank results, calculate running totals and analyse changes over time.
Create tables, import data and bring your SQL skills together in the final board-review project.
In Section 9, create tables and import data, then apply the SQL skills you've developed throughout the course to complete a board-review project for Kettle & Bean. Summarise your findings in plain English and explain what the results mean.

See inside the course
Explore screenshots from the actual lessons, including SQL queries and their results in pgAdmin. Each example uses the course database to show how SQL works in practice. Click or tap any image to see it full size.
Scenes from the lesson
Kettle & Bean Co. is a fictional company created for teaching.
The learning scenario
Each lesson starts with a realistic request from a colleague at a fictional UK coffee and tea retailer. You query the data, check the result and explain what it shows.
Amara
Priya
Grace
Marcus
Tom
Ellie
Created by Virtavis Learning
Data and Business Intelligence Specialist, founder of Virtavis Learning
Sophie Lumpa created this course and designed the Kettle & Bean learning scenario, bringing realistic business questions into the learning experience. The Virtavis teaching team provides additional training and learner support through the Bootcamp and live cohorts.
On the pathway
Questions
If your question isn't answered here, send it to us and the Virtavis team will reply by email.
Contact us ›See how the lessons work before you choose.