SQL Knowledge Center · About ·
Easy Interactive Online SQL Training for Beginners

Learn SQL Online Free - Interactive SQL Tutorial for Beginners

This tutorial provides you with easy to understand SQL instructions and allows you to practice while you are learning, using an online SQL interpreter. By practicing your SQL commands and seeing immediate results you will learn quickly.

More than 200,000 students learnt SQL since 2017.

Use the menu and follow the tutorial to learn SQL on your own.

Interactive SQL Lessons

Click on any lesson below to start learning SQL interactively:

. SELECT specific columns

SELECT * grabs all fields (called columns) in a table. If we only wanted to see the name and num_books_read columns, we would type SELECT name, num...

. WHERE ... Equals

In order to select particular rows from this table, we use the WHERE keyword. So for example, if we wanted to grab all of the rows that correspond...

. WHERE ... Greater than

If we want to only select family members based on a numerical field, we can also use the WHERE keyword. For example, if we wanted to select family...

. WHERE ... Greater than or equal

SQL accepts various inequality symbols, including: = “equal to”> “greater than”< “less than”>= “greater than or equal to”<= “less than ...

. AND

In the WHERE part of a query, you can search for multiple attributes by using the AND keyword. For example, if you wanted to find the friends of P...

. OR

In the WHERE part of a query, you can search for rows that match any of multiple attributes by using the OR keyword. For example, if you wanted to...

. IN

Using the WHERE clause, we can find rows where a value is in a list of several possible values. SELECT * FROM friends_of_pickles WHERE species IN (...

. DISTINCT

By putting DISTINCT after SELECT, you do not return duplicates. For example, if you run SELECT DISTINCT gender, species FROM friends_of_pickles WH...

. ORDER BY

If you want to sort the rows by some kind of attribute, you can use the ORDER BY keyword. For example, if you want to sort the friends_of_pickles ...

. LIMIT # of returned rows

Often, tables contain millions of rows, and it can take a while to grab everything. If we just want to see a few examples of the data in a table, w...

. COUNT(*)

Another way to explore a table is to check the number of rows in it. For example, if we are querying a table states_of_us, we’d expect 50 rows, or ...

. COUNT(*) ... WHERE

We can combine COUNT(*) with WHERE to return the number of rows that matches the WHERE clause. For example, SELECT COUNT(*) FROM friends_of_pickles...

. SUM

We can use the SUM keyword in order to find the sum of a given value. For example, running SELECT SUM(num_legs) FROM family_members; returns the to...

. AVG

We can use the AVG keyword in order to find the average of a given value. For example, running SELECT AVG(num_legs) FROM family_members; returns th...

. MAX and MIN

We can use the MAX and MIN to find the maximum or minimum value of a table. To find the least number of legs in a family member (2), you can run SE...

. GROUP BY

You can use aggregate functions such as COUNT, SUM, AVG, MAX, and MIN with the GROUP BY clause. When you GROUP BY something, you split the table i...

. Nested queries

In SQL, you can put a SQL query inside another SQL query. For example, to find the family members with the least number of legs, you can run: SELE...

. NULL

Sometimes, in a given row, there is no value at all for a given column. For example, a dog does not have a favorite book, so in that case there is...

. Date

Sometimes, a column can contain a date value. The first 4 digits represents the year, the next 2 digits represents the month, and the next 2 digit...

. Inner joins

Different parts of information can be stored in different tables, and in order to put them together, we use INNER JOIN ... ON. Joining tables gets ...

. Multiple joins

In the previous exercise, we explained that TV show character names were not duplicated, so if the name of a character were to change, you would on...

. Joins with WHERE

You can also use joins with the WHERE clause. To get a list of characters and TV shows that are not in “Buffy the Vampire Slayer” and are not Barn...

. Left joins

In the previous exercise, we used joins to match up TV character names with their actors. When you use INNER JOIN, that is called an “inner join” ...

. Table alias

These queries are starting to get pretty long! In the previous exercise, we ran a query containing the tables character, tv_show, and character_tv_...

. Column alias

In addition to making aliases for tables, you can also make them for columns. This clears up confusion on which column is which. In the previous...

. Self joins

Sometimes, it may make sense for you to do a self join. In that case, you need to use table aliases to determine which data is from the “first”/”l...

. LIKE

In SQL, you can use the LIKE command in order to search through text-based values. With LIKE, there are two special characters: % and _. The perc...

. CASE

You can use a CASE statement to return certain values when certain scenarios are true. A CASE statement takes the following form: CASE WHEN *firs...

. SUBSTR

In SQL, you can search for the substring of a given value. Perhaps a location is stored in the format “city, state” and you just want to grab the ...

. COALESCE

COALESCE takes a list of columns, and returns the value of the first column that is not null. Suppose we wanted to find the most powerful weapon th...

1. SELECT *

In SQL, data is usually organized in various tables. For example, a sports team database might have the tables teams, players, and games. A wedding...

Quick Start

New to SQL? Start with these fundamental lessons:

Learn SQL on your own

This tutorial provides you with easy to understand SQL instructions and allows you to practice while you are learning, using an online SQL interpreter. To learn by practicing your SQL commands, seeing immediate results. You will be able to perform selects, inserts, updates, deletes, and drops on your tables. Note: This SQL tutorial uses the SQLite database engine. The different variants of SQL use slightly different syntax.

If you're already familar with the basics of SQL, you can still use this as a refresher, and practice some SQL statements.

How long does it take to learn SQL? How hard is it to learn SQL? Is easy to learn?

Its not very hard and you can learn it very quickly. Follow this interactive online SQL training for beginners (and for FREE) and in no time you will learn all the necessary knowledge to start working and to be confident to say you know SQL in a job interview.

Are SQL queries/syntax case sensitive?

The SQL Keywords are case-insensitive (SELECT, FROM, WHERE, etc), but are often written in all caps. However in some setups table and column names are case-sensitive.

Learn SQL

What is SQL?

SQL stands for Structured Query Language. SQL is used to communicate with a database and SQL is the standard language for relational database management systems. SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database. Common relational database management systems that use SQL are: Oracle, Sybase, Microsoft SQL Server, Access, Ingres, etc.

SQL Tutorial

Easy to learn standard SQL commands such as "Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to accomplish almost everything that you need to do with a database. This SQL tutorial will provide you with the instruction on the basics of each of these commands as well as allow you to put them to practice using the SQL Interpreter.

What Can SQL do?

The Most Important SQL Commands


Why should you learn SQL?

SQL is an incredibly important and valuable skill employers desire. You can earn really good money, SQL programmers are in high demand. As organizations seek to do more with their data, they will need more individuals with the skills to access and analyze that data. SQL is the skill that enables you to do just that.

Learning SQL will allow you to mine data with greater efficiency, as SQL queries can be easily saved and re-used at any point in time. You can do data manipulation, combine data from multiple sources and manage large pools of data. And you will not have to deal with Excel crashing anymore.

Will SQL become obsolete?

My guess is not for a very, very long time, if ever. Business and specially small business will continue to organize data in a relational manner regardless of the underlying data storage and processing technology.