Introduction
Our SQL documentation is a ground up guide to using SQL for querying datasets on data.world. Many of the sections have exercises at the end of them, and these sections and exercises make up our SQL tutorial. There are three sections in this tutorial:
Setting up the tutorial project
In order to do the exercises for our SQL tutorial you will need to have a data.world account. They are free, and you can get one here. If you already have an account on data.world, the previous link will take you to your home page.
The exercises in the tutorial are based on the dataset SQL tutorial exercise data. Once you are logged in to data.world you'll have access to the dataset, and you can create your own project to use with the exercises. You can do the exercises without creating your own project by following the Try query link on each exercise, however we recommend saving your own project with answers for each of the exercises as some of the exercises are built on the results of previous exercises. Follow the steps below to create your project:
Go to the SQL tutorial exercise data dataset on data.world. Select the down arrow to the right of the Explore this dataset button and select + Create a new project
Add your project name, leave all the other options as they are, and select Create project. On the next screen you can either enter a description or do that later.
After you have created your project, the first page you’ll see is the project workspace. If you aren’t familiar with it, please read our article on navigating the project workspace for an overview.
How to use the project
Follow the links in Content and exercises below to read each section in the tutorial. When you are ready to do the exercises, open the project you created for the tutorial and select + Add -> SQL Query in the Project workspace:
You'll be taken to a new blank query window. If you need help on how to format your query or an introduction to data.world’s query tools, see the article Query basics. When you have finished writing and testing your query, select Save next to the Run query button. We recommend that you name your query with the number of the exercise:
If you accidentally write a query after clicking a Try query button you can save it to your tutorial project by selecting your project from the dropdown menu on the field Where will this query be saved?
Content and exercises
The SELECT and FROM Clauses
Exercise 1
Exercise 2
Exercise 3
LIMIT
Exercise 4
WHERE and comparison operators
Exercise 5
Exercise 6
ORDER BY
Exercise 7
Exercise 8
AND, OR, and NOT
Exercise 9
Exercise 10
Exercise 11
Arithmetic Operations
Exercise 12
Exercise 13
IS NULL and IS NOT NULL
Exercise 14
LIKE and NOT LIKE
Exercise 15
Exercise 16
BETWEEN
Exercise 17
OFFSET
Exercise 18
Joins
Exercise 19
Exercise 20
Exercise 21
Exercise 22
CAST
Exercise 23
Aggregations
Exercise 24
Exercise 25
Exercise 26
GROUP BY and FILTER
Exercise 27
Exercise 28
HAVING
Exercise 29
CASE
Exercise 30
IN and NOT IN
Exercise 31
Working With Dates
Exercise 32
Final Notes
Our SQL documentation and tutorial are works in progress and this list of exercises will continue to expand.