Easiest way to practice SQL online (without installing anything)

Arturo S.
3 min readApr 14, 2022

--

Why learn SQL?

Virtually all Data Scientists will stumble upon SQL at one point or another. Mastering it is vital for anyone in the field.

Instead of completing tutorials or courses, I find that writing queries is the best way to learn SQL. However, if you do not have access to a well-organized database, SQL can be rather hard to practice.

This article will show you how to create and populate a famous database so you can practice SQL without the need to install anything on your local computer.

Watch this video in case you do not want to read the whole article.

How to practice SQL online

The first thing we need is an SQL file that will create multiple tables and populate them with data. I will use the Chinook Database throughout this article. However, there are many other databases you can download, such as Sakila, AdventureWorks, etc.

Step 1

Go to this link and download the SQL file that matches the SQL version you want to practice. For example, if you want to practice PostgreSQL, download the file named Chinook_PostgreSql.sql. This file contains a ton of create-table and insert-into statements that will populate the Chinook Database.

Step 1. Download the SQL file that matches the SQL version you want to practice

Step 2

The next step is running the script we just downloaded. Since we do not want to install anything on our computer, we will make use of an online compiler to achieve this step.

Go to SQLite Online and connect to the server that matches the SQL version you want to practice. In this example, we will connect to the PostgreSQL server.

Step 2. Connect to the SQL Server that matches the SQL version you want to practice

Step 3

We now need to open and run the SQL file that creates and populates the database. To do this, go to File > Open SQL and select the SQL file we downloaded.

Step 3. Open the SQL file we just downloaded

Step 4

Once the file is open, click the Run button from the top menu. A bunch of tables will become available on the left-hand side of the screen in a matter of seconds.

Step 4. Run the SQL file

Step 5

We can now play around with SQL. For example, I wrote a short query that fetches the name, artist and album of every song in the Track table.

Step 5. Play around with SQL

Closing remarks

The Chinook Database is case-sensitive by default. Go to this repository to download a case-insensitive version of the SQL file that generates the database. On top of this, the repo contains a few questions to practice joins, aggregate functions and window functions.

--

--

No responses yet