Back to articles list Articles Cookbook
Updated: 30th Oct 2023 11 minutes read

Learn SQL in 10 Minutes

Want to learn SQL fast? Our simple guide will teach you the essentials in just 10 minutes! Start querying data in no time.

In today’s world, we use data for everything, and knowing SQL helps you understand this data better. Learning SQL means you can find and use important information in databases. Knowing SQL is an essential skill in any data-driven industry.

For beginners, learning SQL is made easy with the right guide. The SQL Basics online course is a great place to start. It will teach you main concepts and slowly introduces more advanced topics, making it perfect for those new to SQL. By taking this course, you'll gain the skills needed to use data effectively in many fields.

Now, let's return to the main topic: how to learn SQL when you are in a hurry.

What is SQL

SQL, or Structured Query Language, is a programming language used to communicate with databases. With SQL, you can retrieve data from a database, insert new data, and update or delete existing data. You can even modify the structure of a database: you can add or delete tables or columns and change the relationships between tables.

SQL was designed in the 1970s, so it is a mature and stable technology. If you're interested in learning more about its history, check out this article. Nowadays SQL is the de facto industry standard to work with data. All databases and major data technologies support SQL, all data professionals use SQL in their work.

SQL was developed with non-IT specialists in mind. Its syntax resembles the structure of the English language, making it easy for beginners to learn and understand its syntax.

Do you want to learn more about SQL? I recommend this excellent articles:

What is SQL Used For?

SQL is a tool that is used everywhere in the IT world. SQL databases are utilized to store information for a vast majority of today’s web apps, including e-commerce stores, CRM apps, and many more. SQL helps to manage and use the information stored in databases for various web apps, as well as many mobile and desktop applications.

People who build applications, like software engineers, web developers, and testers, need to know how to use SQL. It helps them create applications that can easily find and use the information they store.

Learn SQL in 10 Minutes

Beyond web development, SQL is also very important in data analysis. It aids analysts in generating simple and complex reports directly from databases. It is used in cleaning data and checking its consistency. It can be used in data integration to combine data from multiple sources.

Major companies, such as Facebook, AirBnB, Uber, Apple, Instagram, Skype, Spotify use SQL on a daily basis.

Learning SQL enables data analysts to work with data more effectively and create better websites and apps.

Can You Learn SQL in 10 Minutes?

SQL was designed to resemble the structure of an English sentence so that everyone, not just IT professionals, can use it. It's easy to start learning it. Obviously, you won't become an expert in 10 minutes, but that's enough time to grasp the basics and see if you like it. That's what this tutorial is here for.

In just a week, you can learn enough to use SQL confidently. See our guide How to Learn SQL in a Week to find out how you can grasp the foundations of SQL in just 7 days.

I've put together this simple guide on the key things you need to know about SQL. This guide breaks down the big ideas into easy-to-understand parts, so whether you're just starting out or already know a bit, it can help clear things up for you. Let’s start simple.

What Is a Database?

A database is a computer system that knows how to store, organize, and retrieve data. In your own business you may store all the data related to your company: client data, product data, sales data, etc. in one database. A database can handle much larger quantities of data compared to what you might store in an Excel file or a text file. This data is stored in a structured format, which we will explain shortly.

Databases are designed to access and modify large datasets efficiently, and they allow for concurrent access, meaning that many users can access and modify data simultaneously without causing issues.

Popular database management systems (DBMS) include MySQL, Microsoft SQL Server, PostgreSQL, and Oracle — you might have come across these names before. These systems utilize SQL to interact with the data they store. Many other data technologies also support SQL, attesting to its widespread use and versatility.

Looking to find out which database is most popular now? Check out this article.

The Tables and the Structure of a Database

A key component of the database structure is the table. Each table is used to store data related to one category of objects in the real world. In our earlier example, we may define three tables: users, products, and sales.

A table contains columns that represent the characteristics of the data we store. A table like users may contain columns such as first_name, last_name, gender, SSN, etc.

A table has rows with data for different objects. If the users table has 1,000 rows, it represents 1,000 different users, one per row.

Conventionally, the first column of a table is a column called id that contains numbers to uniquely identify a row. In some cases, this value may be a key reference for other tables. Let’s see the following example:

Learn SQL in 10 Minutes

Marty McFly (ID 132) bought a hoverboard (ID 1254). Both values are referenced in the table sales, and the three tables are thus related. Also, Han Solo bought a Millennium Falcon, and Thanos bought Infinity Gems.

Examples of SQL Queries

In SQL, we communicate with a database using queries. An SQL query is a command to get data out of a database.

SQL queries are designed to resemble an English sentence. They start with an action keyword (such as SELECT or UPDATE) and continue with additional information. SQL queries can get all the data from a database, filter data that satisfies certain criteria, and even perform computations on the data.

Let’s see real examples of SQL queries.

Getting all Data From a Table

This query:

SELECT * FROM table

selects all information – all columns and rows – from the table specified. The query starts with SELECT, to tell the database we want to select data. The asterisk (*) tells the database we want to select all columns from the table. After FROM, we put the name of the table from which we want to select. As a result, it selects all rows and all columns from the table.

Let’s try this with the example we saw earlier:

SELECT *
FROM users;

This gives the following:

idfirst_namelast_namessnphoneage
132MartyMcFly11111111112345678917
625HanSolo22222222298765432132
9745ThanosDione333333333458712961000

This is extremely simple, isn't it? The SQL syntax is easily understandable and intuitive.

Getting Some Columns From a Table

Let’s see another scenario.

Sometimes, we don’t want to see all the columns in the table. This query:

SELECT col1, col2 FROM table

allows us to select only the columns we want. After the SELECT clause, we list the names of the columns, separating them with commas. There is no limit to the number of columns; we may list just one or list all the columns of the table.

In this example, we need the id, the first name, and the last name from the table users:

SELECT
  id,
  first_name,
  last_name
FROM users;

It gives the following:

idfirst_namelast_name
132MartyMcFly
625HanSolo
9745ThanosDione

As in the earlier example, the query is very easy to understand.

Getting Some Columns and Some Rows From a Table

Great! Now, we know how to filter the columns of a table.

How about filtering rows? This is easy with a WHERE clause to set a condition for the query:

SELECT col1, col2 FROM table WHERE x = y;

Imagine we are given a user ID and need to search our database to retrieve the user. We can do this:

The condition id = 625 tells the database we are interested only in rows whose id column has the value 625. There’s only one row that satisfies this condition:

idfirst_namelast_name
625HanSolo

This is extremely powerful! Imagine you have a database with millions of entries. You can retrieve a user in milliseconds thanks to a short query!

Equality is not the only allowed operator inside a condition. We may use any of the following operators: <, <=, >, or >=, with a number. As an example, if we apply a filter to ssn like this:

SELECT
  id,
  first_name,
  last_name,
  ssn
FROM users
WHERE ssn >= 222222222;

It gives the following:

idfirst_namelast_name
625HanSolo

There is more we can do with a WHERE clause. We may create multiple conditions, thanks to the AND operator.

Imagine we want to filter our users for an age range. We can do so easily, like this:

SELECT
  id,
  first_name,
  last_name,
  age
FROM users
WHERE age >= 20 AND age <= 40;

This query finds users who are 20 years old or greater and at the same time are 40 or less. It gives the following result:

idfirst_namelast_nameage
625HanSolo32

Note that we can do the same thing more elegantly with the BETWEEN operator:

SELECT
  id,
  first_name,
  last_name,
  age
FROM users
WHERE age BETWEEN 20 AND 40;

Pretty easy, right? If you are not yet convinced, read the article by Jill Thornhill, “Is SQL Hard to Learn?

How to Learn SQL in a Day – Interactive Courses From LearnSQL.com

Has this made you curious? Do you want to learn more?

The best way to learn SQL is through writing SQL queries. I sincerely recommend online courses at LearnSQL.com. They online courses at LearnSQL.com are highly interactive. You learn new concepts and practice them immediately through small exercises. You are asked to write real SQL code and run it, and the platform tells you whether it is correct. Through many exercises, you become more confident and build solid SQL knowledge until you become an SQL expert.

The best place to start is the course SQL Basics. It contains 129 hands-on exercises. It covers the foundations of SQL and can be done in about 20 hours – less than a day.

And the best thing is that you don’t need to install ANYTHING on your computer. The only things you need are an Internet connection and a web browser! Look at the following screenshot:

Learn SQL in 10 Minutes

Overview of an interactive SQL course on LearnSQL.com

Amazing, isn’t it? On the left-hand side, you read the lesson; on the right-hand side, you edit the SQL code and see the results. It couldn’t be simpler!

More Resources to Learn SQL Fast

If you're eager to dive deeper and accelerate your SQL learning journey, we have compiled a list of resources that are tailored to help you grasp the concepts quickly and efficiently. Here are some handpicked resources that you can explore:

1. SQL Primer by LearnSQL.com

Dive into the world of SQL with this comprehensive primer that breaks down the fundamentals of SQL in an easy-to-understand manner. Whether you are a beginner or looking to refresh your knowledge, this primer is a great starting point. You can download the PDF here.

2. The Book "Learn SQL in 10 Minutes" by Ben Forta

This book promises a fast track to learning SQL, offering lessons that are easy to digest, making it possible to learn SQL in the span of just a few short sessions. Ben Forta's expertise guides you through the essential skills you need to work with SQL databases. Grab your copy on Amazon. More on SQL books in this article.

3. "Best Way to Learn SQL" Guide

If you are pondering the most effective approach to learning SQL, this article is for you. It outlines the best strategies to learn SQL, offering tips and guidance to steer your learning path in the right direction. Read the full article here.

Feel free to explore these resources at your own pace. Each one offers a unique perspective and approach to learning SQL, helping you become proficient in no time. Happy learning!

Learn SQL Today!

That’s it – you can learn SQL in 10 minutes! I truly hope this article has motivated you to dive deeper into SQL concepts.

You can find on LearnSQL.com all the courses and resources you need to power your SQL career. If you’re a beginner, start with the SQL Basics course. It has 129 hands-on practical exercises to help you learn everything you need to get started with SQL.

What to do next:

So, what are you waiting for? Learn SQL and become an expert!