Introduction
1. Introduction
Exercises

Instruction

Hello, and welcome to the SQL Practice Set! 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 of the exercises is roughly the same as in the SQL Basics course. Topics covered include: SELECTs, aggregate functions (COUNT, SUM, AVG), grouping and ordering results, JOINs, and subqueries.

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 filter the result of your query, you use the WHERE keyword and a condition:

  • Use comparison operators (=, !=, <, >, <=, >=) to compare values.
  • You can combine conditions with the logical operators: AND, OR, NOT.
  • The percentage sign % is used with the LIKE operator to replace any number of unknown characters. For instance, if we want to show only data from the name that starts with 'F', we would write:
    WHERE name LIKE 'F%'
  • If we want to replace only one unknown character, we use the underscore symbol _. For example:
    WHERE name LIKE '_atherine'
  • The NULL represents an unknown or missing value. You use the IS NULL or IS NOT NULL operators to filter NULL values.

Exercise

Click the Next exercise button to continue.

Console

Code editor

Result

TableConsole