Back to articles list Articles Cookbook
5 minutes read

SQL Crash Course: Learn SQL in One Sitting

Ready to dive into SQL? In just one sitting, you’ll learn the essential SQL queries to start working with databases, from selecting and filtering data to sorting results.

Got an hour? That’s all you need to start writing real SQL queries. In this crash course, we’ll cover the essential basics: selecting data, filtering results, and sorting. These are the building blocks for working with databases, and by the end, you'll be able to run your first queries with confidence. Want to take your learning further? Check out our SQL Basics course at LearnSQL.com for a deeper dive into SQL.

What Is SQL and What Can You Do With It?

SQL (Structured Query Language) is the standard language for working with databases. A database is a computer program that stores and organizes large amounts of information, making it easy to retrieve, update, and manage. With SQL, you can:

  • Look up sales data for a report
  • Pull customer lists by location or signup date
  • Create the numbers behind your dashboards

At the heart of a database are tables — structured sets of data, just like spreadsheets. Each table contains columns (attributes like name, email, or price) and rows (individual records).

Here's an example of a table named customers:

idfirst_namelast_namecountry
1AnnaSmithGermany
2JamesLeeUSA
3MariaGonzalezSpain

Everything you do in SQL starts with asking a question about data like this.

Your First SQL Query — SELECT and FROM

Let’s say we want to see all the data from the table customers. In SQL, you write commands called queries. Queries in SQL follow a specific syntax, as we’ll soon see.

Here’s your first query:

SELECT * 
FROM customers;

What the query does:

  • SELECT tells SQL what data to retrieve
  • * means “all columns”
  • FROM specifies which table you’re pulling data from

That query returns every column and every row in the customers table.

You can make your queries more specific. If you want to select only the first name and country of customers, you can write a query like this:

SELECT first_name, country 
FROM customers;

After SELECT, you specify the columns you want to retrieve, and then follow it with FROM and the table name, as we saw earlier. This makes your query neater and more focused — which is especially important when tables have dozens of columns.

🎯 Try it yourself in our interactive SQL Basics course — no setup needed.

Filtering Rows with WHERE

SELECT helps you retrieve only the columns you need. If you want to select specific rows, you use WHERE to filter your results.

Suppose you want to find only the customers from Germany. Here’s the query you’d write

SELECT * 
FROM customers 
WHERE country = 'Germany';

After WHERE, you specify the condition that the selected rows must satisfy. In this case, the condition is country = 'Germany'. This means we are selecting customers where the country column is equal to "Germany". Note that we put "Germany" in single quotes ('Germany'), which tells SQL that it's a text value, not a column name.

The query returns only the rows where the country equals "Germany".

You can also use other comparison operators:

  • != (not equal to)
  • <, >, &lt;=, >= (less than, greater than, etc.)

For example, to find orders with a total above 100, you’d write:

SELECT * 
FROM orders 
WHERE total > 100;

Note that numeric values are not enclosed in quotes and are written as they are.

You can also combine conditions using AND or OR. For example, this query selects customers from Germany whose first name is Anna:

SELECT * 
FROM customers 
WHERE country = 'Germany' 
AND first_name = 'Anna';

📌 Mini Task: Can you find all customers from Spain?

Sorting with ORDER BY

The final thing we’re going to cover in this crash course is sorting. Let’s say you want to see your customer list sorted alphabetically. Here’s how you can do this:

SELECT * 
FROM customers 
ORDER BY last_name ASC;
  • ORDER BY sorts the results by a column
  • ASC means ascending (A to Z, smallest to largest)
  • DESC means descending (Z to A, largest to smallest)

You can also sort by more than one column, like this

SELECT * 
FROM customers 
ORDER BY country ASC, last_name ASC;

📌 Mini Task: Try sorting your orders by total value, highest first.

What You Can Do Next

In one sitting, you’ve learned how to:

  • Read data from a table using SELECT
  • Pick specific columns
  • Filter rows with WHERE
  • Sort results with ORDER BY

That’s the foundation of SQL andit’s powerful enough to handle a lot of everyday tasks.

But there’s more to discover — things like:

  • Bringing together information from different lists (tables)
  • Grouping similar data together to see patterns
  • Calculating totals or averages to create reports

Want to dive deeper? In our SQL Basics course, you’ll learn all of these concepts and more through interactive exercises that build on everything you’ve just learned — and take your skills to the next level.

Ready to Keep Learning?

You’ve just written your first SQL queries — that’s a huge step forward! Why stop now? Keep the momentum going and take your skills to the next level with our SQL Basics course . It’s designed for beginners, packed with hands-on exercises to reinforce what you’ve learned and build on it step by step.

Don’t stop now — your SQL journey is just getting started!