Ask how long it takes to learn SQL and you'll hear "a weekend" from one person and "years" from another. Both are right, because they mean different things. Writing your first query that pulls rows from a table takes an afternoon. Answering real questions from a messy company database without help takes months of practice.
The good news: SQL is one of the smallest languages you can learn. A handful of keywords does most of the work. This guide explains what "learning SQL" means at each level, what you can do after a day, a month and three months, and gives a plan for someone with one hour a week. Every query in it was run in SQLite, and the results are real.
What "learning SQL" means
SQL (Structured Query Language) is the language for asking questions of a database: "Which customers ordered more than twice?", "What was our revenue each month?" It's different from Python or JavaScript in one important way. You describe what you want, and the database works out how to get it.
That's why "learning SQL" breaks into clear levels:
- Reading data:
SELECT,WHERE,ORDER BY. Pulling the rows and columns you want from one table. - Summarising data:
COUNT,SUM,AVG,GROUP BY,HAVING. Turning thousands of rows into a few numbers. - Combining tables:
JOINandLEFT JOIN. Real databases spread information across many tables. - Changing data and designing tables:
INSERT,UPDATE,DELETE, keys and constraints. - Advanced analysis: subqueries, common table expressions (
WITH) and window functions.
Most people who use SQL at work, like analysts, marketers and product managers, spend their time in levels 1 to 3. Developers also need level 4. Level 5 is where data analysts and engineers spend years getting better.
The short answer
Our estimate, for a beginner who practises steadily:
- One day: you can write
SELECTqueries withWHEREandORDER BYon a single table. - Two to four weeks of regular practice:
GROUP BY, aggregates and simple joins. That's enough to answer most everyday business questions. - Two to three months: comfortable with joins across several tables,
LEFT JOIN,HAVING, and the common mistakes. You can work on a real database with occasional help. - Six months and more: window functions, query performance and complex reports, built up through real work.
"Regular" matters more than "a lot". Three short sessions a week will take you further than one long weekend a month.
What you can do after one hour
A first query is short. Here's a table of orders from a small online shop:
CREATE TABLE orders (id INTEGER PRIMARY KEY, customer TEXT, city TEXT, order_date TEXT, amount REAL);
INSERT INTO orders (customer, city, order_date, amount) VALUES
('Alex', 'Lisbon', '2026-09-03', 42.50), ('Sam', 'Berlin', '2026-09-05', 18.00),
('Alex', 'Lisbon', '2026-09-20', 30.00), ('Mia', 'Berlin', '2026-10-02', 75.25),
('Sam', 'Berlin', '2026-10-11', 22.00), ('Noah', 'Dublin', '2026-10-15', 12.75),
('Mia', 'Berlin', '2026-10-28', 40.00), ('Alex', 'Lisbon', '2026-11-01', 55.00);And here's a question you can answer in your first hour: which orders were over 40, biggest first?
SELECT customer, amount
FROM orders
WHERE amount > 40
ORDER BY amount DESC;customer amount
-------- ------
Mia 75.25
Alex 55.0
Alex 42.5Read it almost like English: select the customer and amount, from the orders table, where the amount is over 40, ordered by amount, biggest first. This readability is why SQL is often the fastest first language to become useful with.
What you can do after a month
After a few weeks you can summarise. Revenue per city:
SELECT city, COUNT(*) AS orders, SUM(amount) AS revenue
FROM orders
GROUP BY city
ORDER BY revenue DESC;city orders revenue
------ ------ -------
Berlin 4 155.25
Lisbon 3 127.5
Dublin 1 12.75GROUP BY is the point where many beginners slow down, because it changes how you think about rows: from "one row at a time" to "one row per group". It's also where the most confusing errors appear. Our article on GROUP BY errors explains the common ones.
What you can do after three months
After two or three months of practice, you combine tables and handle the cases that trip people up, like customers who never ordered:
CREATE TABLE customers (name TEXT PRIMARY KEY, signup_channel TEXT);
INSERT INTO customers VALUES ('Alex', 'newsletter'), ('Sam', 'search'),
('Mia', 'search'), ('Noah', 'friend'), ('Lena', 'newsletter');
SELECT c.name
FROM customers c
LEFT JOIN orders o ON o.customer = c.name
WHERE o.id IS NULL;name
----
LenaLEFT JOIN keeps every customer, even without matching orders, and WHERE o.id IS NULL keeps only those with no order. It's three lines, but understanding why it works is a real step up. You've learned to think in sets.
The plan, with one hour a week
If you can give SQL one focused hour a week, plus 15 to 20 minutes of practice on another day, here's a realistic order:
- Week 1: What a database is. Tables, rows, columns, and a first
CREATE TABLE. Install a tool like DB Browser for SQLite, or use one that runs in the browser. - Week 2: Designing tables. Primary keys, foreign keys, and why you split data into several tables.
- Week 3: Asking questions with SELECT.
WHERE,ORDER BY,LIMITandLIKEfor searching text. - Week 4: Joining and summarising.
JOIN,LEFT JOIN,COUNT,AVGandGROUP BY. - Week 5: Changing data safely.
INSERT,UPDATE,DELETE, constraints and indexes, and a small database of your own.
After these five weeks, you know the core of SQL. The next months are about practice on bigger and messier data. If your goal is data analysis, the next steps are date functions, common table expressions (WITH) and window functions, in that order.
Why one hour a week can be enough
It seems slow, but SQL rewards spaced practice. Each new keyword builds on the last, and coming back after a few days forces you to remember, which is how things stick. What matters is that you write the queries. Reading a tutorial about JOIN and writing one that returns the wrong number of rows are very different experiences, and only the second teaches you.
The 15 to 20 minutes between sessions should be practice, not new material: rewrite last week's queries from memory, or ask a new question of the same table.
What speeds you up
- Using a dataset you care about. Your own spending, a sports league, your book list. You'll ask better questions.
- Predicting the result before you run a query. "This should return three rows." When it returns five, you've found something to learn.
- Reading error messages properly. SQL errors are short and usually name the exact problem, like a column that doesn't exist. See SQLite: no such column.
- Learning one database first. SQLite, PostgreSQL and MySQL share most of the core language. Pick one and stick with it until the basics feel natural.
What slows you down
- Only watching videos. It feels like learning. Without typing queries, little of it stays.
- Jumping to advanced topics. Window functions are impressive, but if
GROUP BYstill confuses you, they will too. - Copying queries from AI without reading them. A query that runs isn't always a query that's right. A wrong join can quietly double your numbers. Our guide to learning to code with AI covers how to use it without losing the learning.
- Worrying about which database to learn. The differences matter much later than you think.
How to know you're ready for the next level
Time is only a rough guide. A better test is whether you can answer questions on your own. Try these with the orders table above, without looking anything up.
Ready to leave level 1 when you can write, from memory:
- All orders from Berlin, newest first.
- The three biggest orders.
- Customers whose name starts with "A".
Ready to leave level 2 when you can:
- Count the orders for each customer.
- Find the average order amount per city, rounded to two decimals.
- Show only the cities with more than two orders, and explain why that needs
HAVINGand notWHERE.
Ready to leave level 3 when you can:
- List every customer with their number of orders, including customers with zero.
- Explain what would happen to your totals if a customer appeared twice in the customers table.
If you can do these without help, and explain each query out loud, you've learned more SQL than many people who use it occasionally at work. If one of them stops you, that's exactly where to practise next.
Is SQL easier than Python?
For most beginners, the first steps in SQL are easier: fewer keywords, no loops, and results you can see as a table. Python is a general-purpose language with more to learn before you're productive. They also work well together: SQL gets the data, Python does everything else with it. If you're still choosing, our comparison of which programming language to learn first puts Python, JavaScript, SQL and Java side by side.
Frequently asked questions
Can I learn SQL in a weekend?
You can learn the basics of SELECT, WHERE and ORDER BY in a weekend. Joins and GROUP BY take longer to feel natural, usually a few weeks of practice.
Do I need to know maths to learn SQL?
Only basic arithmetic. SUM, AVG and percentages are as far as most SQL work goes. Thinking clearly about "which rows do I want" matters far more.
Do I need to install anything?
Not at first. There are tools that run SQL in the browser. Later, a free tool like DB Browser for SQLite is a good step.
Which SQL should I learn: MySQL, PostgreSQL or SQLite?
Start with any of them. The core language is shared. SQLite is the simplest to start with because the whole database is one file and there's no server to set up.
What's the hardest part of SQL for beginners?
For most people, GROUP BY and joins. Both ask you to stop thinking about one row at a time and start thinking about groups and sets of rows. Expect them to take a few sessions to click, and practise them on small tables where you can check every result by eye.
How can I practise SQL for free?
Install a free tool like DB Browser for SQLite, create a small table about something you know, and write questions about it. Public datasets from open data portals give you bigger tables once the basics feel comfortable. The orders table in this article is a good start: copy it and try the questions in "How to know you're ready".
Is SQL enough to get a job?
On its own, rarely. Combined with spreadsheets and a reporting tool, it's the core skill for many data analyst roles. Combined with Python or JavaScript, it's expected of most developers.
A quick checklist
- Decide your goal: everyday reports, analysis, or development.
- Learn in order: SELECT, then GROUP BY, then JOIN, then changing data.
- Write every query yourself and predict the result first.
- Practise between sessions on a dataset you care about.
- Read each error message before you change anything.
