SQL for Beginners: Where to Start, and What to Expect
By Owen Middleton · Updated October 2026 · We ran the examples on PostgreSQL 17
SQL for beginners, in one sentence: SQL is the language that you use to ask a database for data. You can start to learn SQL with no programming experience. Your first SQL query is below, and you can run it on this page.
After the query, you find the five basic SQL commands, the order of topics to learn, and where beginners make mistakes. We make SQLMaxx Learn, a free SQL course, so we are not neutral on these questions.
What is SQL, for a beginner?
For a beginner, SQL is the language for questions to a database. In a relational database, the data is in tables of rows and columns. You write a query, and the database engine finds the rows that match it. In SQL, you write a query with the SELECT command (PostgreSQL 17 documentation, Queries: Overview).
There is an international standard for SQL, ISO/IEC 9075. ISO and IEC release a revised version of the standard from time to time. The most recent version is from 2023, with the short name SQL:2023 (PostgreSQL 17 documentation, SQL Conformance; BSI catalog, ISO/IEC 9075-1:2023).
A first SQL query on a table of departments
In the examples, you query the departments table of a small sample company. In the table,
there are 8 rows, one row for each department, with its name, its location and its budget:
Schema · hr1 table? = nullable
With this query, you get the name and the location of each department, sorted by name:
SELECT name, location
FROM departments
ORDER BY name; | name | location |
|---|---|
| Data | San Francisco |
| Engineering | San Francisco |
| Finance | Chicago |
| HR | Chicago |
| Marketing | New York |
| Product | San Francisco |
| Sales | New York |
| Support | Austin |
Read the query as an English sentence: select the name and the location, from the departments table, in the order of the name. To get only the departments in Chicago, add a WHERE line:
SELECT name, location
FROM departments
WHERE location = 'Chicago'
ORDER BY name; | name | location |
|---|---|
| Finance | Chicago |
| HR | Chicago |
Now try it yourself. Change 'Chicago' to 'Austin' or 'New York', and press Run:
SELECT name, location FROM departments WHERE location = 'Chicago' ORDER BY name;
With this query, you get the three departments with the largest budget:
SELECT name, budget
FROM departments
ORDER BY budget DESC
LIMIT 3; | name | budget |
|---|---|
| Engineering | 4200000.00 |
| Sales | 3500000.00 |
| Data | 2200000.00 |
With DESC, you sort from the largest budget down, and with LIMIT 3, you keep only the first three rows.
For a SQL tutorial for beginners on SELECT, with more examples, read lesson 1 on SELECT.
What are the five basic SQL commands?
In most beginner guides, you find the same five basic SQL commands, but in some guides, the fifth command is ALTER, not CREATE. Here is each command, with its one-line description from the PostgreSQL documentation (PostgreSQL 17 documentation, SQL Commands):
SELECT: "retrieve rows from a table or view".INSERT: "create new rows in a table".UPDATE: "update rows of a table".DELETE: "delete rows of a table".CREATE TABLE: "define a new table".
SQLMaxx Learn is about queries, and you write a query with SELECT. It has no lessons on INSERT, UPDATE or DELETE. Its one lesson on table creation is lesson 41, "Temp Tables and CREATE TABLE AS SELECT". In our view, a data analyst writes SELECT queries most of the time.
Can you learn SQL with no programming experience?
Yes, you can learn SQL as your first language, with no programming or coding experience. In SQL, you describe the result that you want. You do not write the steps to get it. PostgreSQL selects the way to run your query (PostgreSQL 17 documentation, Planner/Optimizer).
In the queries above, you see no variables and no loops. You name the columns, the table and the condition. For example, in the Chicago query, you do not tell PostgreSQL to read each row and compare its location. You write the condition, and PostgreSQL selects how to find the rows.
If you work in a spreadsheet, you already know tables of rows and columns. In a SQL query, you use the same idea. In our view, that is why SQL is a good first language for a person who works with data.
A related question is “can I learn SQL without knowing Python?” Yes. You need no other language before SQL.
What do you need to start learning SQL?
To start, you need a computer with a web browser. You can run the queries on this page and lesson 1 of SQLMaxx Learn in your browser, with no installation and no account. PostgreSQL runs your queries in the browser.
Later, you can install a database on your own computer. PostgreSQL is free. It has the PostgreSQL License, "a liberal Open Source license, similar to the BSD or MIT licenses" (PostgreSQL License).
You also need lessons and practice problems. On our course page, you can learn SQL for beginners in 66 lessons, in order. Some SQL courses are free.
We compare free SQL courses for beginners on five tests.
- How much is free.
- A check on your queries.
- How far the free part goes.
- A start with no account and no installation.
- An update in the last two years.
Which SQL topics should a beginner learn first?
Learn queries on one table first. Then add one new topic at a time, in this order:
- Topic 1: queries on one table, with SELECT, WHERE and ORDER BY.
- Topic 2: aggregates, GROUP BY and HAVING.
- Topic 3: joins, for queries on two or more tables.
- Topic 4: subqueries.
- Topic 5: CTEs and window functions.
We took the order of the first four topics from a study of how hard students found seven types of SQL query. In that study, self-joins were harder than subqueries. The place of CTEs and window functions is our own choice. Practice from memory, practice on several different days, and check each result.
In SQLMaxx Learn, the 66 lessons are in 5 tiers: Foundations, Core SQL, Intermediate, Advanced and Expert. In our guide on how to learn SQL for beginners, you get the full method and the studies behind it. We plan a separate guide on how long it takes to learn SQL.
Where do SQL beginners make mistakes?
SQL beginners make two kinds of mistakes:
- A syntax error: for most syntax errors, PostgreSQL stops the query and shows an error message. You see the mistake.
- A logical error: PostgreSQL runs the query and gives you a result, but the result is not the answer to your question. You get no error message.
One study looked at 744 students in a university database course. A syntax error was less likely than a logical error to stay in the final answer (Taipalus and Perälä, 2019).
Here is one logical error. With the condition <> 'London' on a column, PostgreSQL does
not count the rows where that column is NULL. If you want those rows in the count, your count is too
small, and you get no error message.
To find a logical error, compare the result with a number that you know, for example a row count. In our view, this check is the most important habit for a SQL beginner. In our answer to the question “is SQL hard for beginners?”, you can run this error and others in a real database.
Is SQL still worth learning in 2026?
Yes. Employers still ask for SQL in job posts for data analysts and for other data jobs. In our view, you can use an AI tool to write a query, but you must read the query and check the result yourself.
If your question is “does SQL have a future?”, start with the job data. We compare the studies of SQL in job posts and show where their results are different.
Guides on SQL for beginners, by question
In each guide below, we answer one beginner question about SQL in full.
Before you learn SQL
- Is SQL Worth Learning in 2026?
Compare the job data for SQL from several studies, and decide if SQL is right for you.
- Is SQL Hard to Learn?
See why your first SQL queries are easy and where beginners have problems. Then try a query in a real database.
Plan your SQL learning
- How to Learn SQL From Scratch, Step by Step
Learn SQL in this order: one table, GROUP BY, joins, subqueries, then CTEs and window functions. Then use our practice method.
SQL and other tools
- Should I Learn SQL or Python First?
Learn which language to start with for your goal, and see one question solved in SQL and in Python.
- SQL vs Excel: What Is the Difference?
Compare two tasks in Excel and in SQL, side by side, and learn when to use each tool.
SQL in data analyst work
- SQL for Data Analysts: The Queries Analysts Run
See what data analysts do with SQL, and run real analyst queries on the data of a made-up SaaS company.
- What SQL Do Data Analysts Need, and How Much?
See the SQL topics for analyst work in three levels, each with free lessons, and check your level with one task.
Start SQLMaxx Learn lesson 1
Lesson 1 of SQLMaxx Learn is "SELECT and Column Expressions". You can start it in your browser with no account.
You write each query in a real PostgreSQL database and press "Check answer", but you learn only PostgreSQL and see no video.
Questions beginners ask about SQL
Can I learn SQL on a Mac?
Yes. On a Mac, you can run the queries on this page and lesson 1 of SQLMaxx Learn in a web browser, with no installation. For a database on the Mac itself, you can get PostgreSQL packages for macOS from several sources, for example the EDB installer, Postgres.app and Homebrew. In our view, start in the browser, and install a database when you want to query your own data. Source: PostgreSQL downloads for macOS.
Is SQL a programming language?
In our view, yes: SQL is a language for one job, to work with the data in a database. The formal name of the SQL standard is ISO/IEC 9075 "Database Language SQL". With SQL, you describe the data that you want, and the database engine finds it. You do not write the steps. Source: PostgreSQL 17 documentation, SQL Conformance.