Skip to main content

data.world SQL tutorial

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

  • How to use the project

  • Content and exercises

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

.pngAdd 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.

Image_2019-09-19_at_3.42.17_PM.png

After you have created your project, the first page you’ll see is the project workspace.

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:

Add_query_to_project.png

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 tutorial on 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 (e.g., Exercise 1).

The SELECT and FROM Clauses

An introduction to the SELECT and FROM clauses and their related keywords

LIMIT

An introduction to the LIMIT clause.

WHERE and comparison operators

An introduction to the WHERE clause and comparison operators.

ORDER BY

An introduction to the ORDER BY clause.

AND, OR, and NOT

An introduction to the keywords ANDOR and NOT.

Arithmetic Operations

An introduction to the arithmetic operators +, -, *\.

IS NULL and IS NOT NULL

An introduction to the expressions IS NULL and IS NOT NULL.

LIKE and NOT LIKE

An introduction to the LIKE and NOT LIKE keywords.

BETWEEN

An introduction to the keyword BETWEEN.

OFFSET

An introduction to the keyword OFFSET.

Joins

An introduction to table joins including the conditions used in them, and their different types.

CAST

An introduction to the expression CAST.

Aggregations

An introduction to aggregations, aggregation functions, and aggregation modifiers.

GROUP BY and FILTER

An introduction to the GROUP BY clause and FILTER modifier.

HAVING

An introduction to the HAVING clause.

CASE

An introduction to the CASE expression.

IN and NOT IN

An introduction to the expressions IN and NOT IN.

Working With Dates

An introduction to working with dates.

Final Notes

Our SQL documentation and tutorial are works in progress and this list of exercises will continue to expand.