Hello, and welcome to the SQL Practice Set in PostgreSQL! This package of exercises will help you practice everything you know about basic SQL queries and is perfect for anyone who wants to strengthen their SQL skills.
The difficulty level of the exercises is roughly the same as in the SQL Basics in PostgreSQL course. Topics covered include: SELECT
s, aggregate functions (COUNT
, SUM
, AVG
), grouping and ordering results, JOIN
s, and subqueries. We will start each part with a brief reminder of the syntax needed to solve it and we'll continue with the exercises.
Here's a quick reminder of the basic SELECT
syntax:
SELECT name, age
FROM client
WHERE age > 18
You select data by using the SELECT
keyword, listing the columns, and then using the FROM
keyword where you tell the database to select data from a given table.
To select all columns from a table you can use the asterisk *
instead of the column names:
SELECT *
FROM client
To filter the result of your query, you use the WHERE
keyword and a condition: