Learn SQL plan: four weeks of queries on a real practice database
SQL is one of the fastest skills to learn for data jobs, but only if you write queries against real tables, not just read about them. This prompt has your todo.is agent build a small practice database, plan four weeks from SELECT to window functions, and run your answers to tell you if they are right.
The prompt
- Make me a 4-week plan to learn SQL for [GOAL]. My level is [CURRENT LEVEL] and I will use [DATABASE]. I have [TIME PER DAY] a day. Create a practice SQLite database about [PRACTICE TOPIC] with 4 related tables (at least 500 rows) and send me the .db file plus setup steps for DB Browser for SQLite. Plan: SELECT and WHERE, ORDER BY and LIMIT, aggregates and GROUP BY/HAVING, INNER and LEFT JOIN, CASE, subqueries and CTEs, then window functions (ROW_NUMBER, RANK, running totals). Each day: 5 questions in plain English, a hint for each and the answers in a separate file. Email it all to me. When I send my query, run it on the database, tell me if the result matches and explain any difference.
What to change
- [GOAL]: E.g. "data analyst interviews", "reporting at work", "a backend course".
- [CURRENT LEVEL]: E.g. "never written a query" or "I know SELECT but not JOINs".
- [DATABASE]: E.g. "PostgreSQL", "MySQL", "SQL Server", "BigQuery" or "not sure". The plan notes syntax differences.
- [TIME PER DAY]: E.g. "30 minutes".
- [PRACTICE TOPIC]: E.g. "an online shop", "a library", "a gym", "football matches".
Example result
- Learn SQL in 4 weeks: data analyst interviews
- Knows SELECT only · target PostgreSQL · 30 minutes a day
- Your practice database (online shop)
- • customers (customer_id, name, country, signup_date)
- • orders (order_id, customer_id, order_date, status)
- • order_items (order_id, product_id, quantity, unit_price)
- • products (product_id, name, category, price)
- Week 1: filter and sort
- • SELECT columns, WHERE with AND/OR, IN, BETWEEN, LIKE, IS NULL
- • ORDER BY and LIMIT
- • Q: customers from Spain who signed up in 2024, newest first
- Week 2: summarise
- • COUNT, SUM, AVG, MIN, MAX, GROUP BY, HAVING
- • Order of execution: FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY
- • Q: product categories with more than 100 units sold
- Week 3: combine tables
- • INNER JOIN vs LEFT JOIN, joining 3 tables, CASE WHEN
- • Q: customers who never ordered (LEFT JOIN + WHERE o.order_id IS NULL)
- Week 4: analyst level
- • Subqueries and CTEs (WITH … AS)
- • Window functions: ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY order_date)
- • Running totals with SUM() OVER (ORDER BY order_date)
- • Interview classics: second highest value, top 3 per group, month-over-month change
- Sample answer
- Q: revenue per category, highest first.
- SELECT p.category, SUM(oi.quantity * oi.unit_price) AS revenue
- FROM order_items oi
- JOIN products p ON p.product_id = oi.product_id
- GROUP BY p.category
- ORDER BY revenue DESC;
- Sample check of your query
- • Your result: 6 rows, Electronics first. Correct.
- • Note: you grouped by p.name too, so earlier you had 48 rows. Group only by what you want one row for.
- PostgreSQL vs SQLite notes
- • Dates: date_trunc('month', order_date) in PostgreSQL, strftime('%Y-%m', order_date) in SQLite
How to do it with todo.is
- Fill in your goal, level and the database you will use at work or in interviews.
- Send the to-do to your agent from todo.is, WhatsApp or Telegram.
- You get a practice .db file, a PDF plan, the daily questions and the answers by email.
- Paste any query you write. Your agent runs it on the same database and tells you if it is right.
Tips for a better result
- Always ask "what is one row of my result?" before writing GROUP BY. It prevents most wrong totals.
- Learn LEFT JOIN with the "never ordered" question. It is the clearest way to see what LEFT JOIN keeps.
- Write SQL in the order it runs (FROM and JOIN first, then WHERE), even though SELECT comes first on the page.
- Window functions come up a lot in data interviews. Practise top-N-per-group until you can write it from memory.
learn SQL plan: FAQ
- How long does it take to learn SQL? The basics (SELECT, WHERE, GROUP BY, JOIN) take 1 to 2 weeks of daily practice. Being comfortable with subqueries and window functions for interviews usually takes 4 to 8 weeks.
- Which SQL should I learn first? Start with whatever your job or course uses; the core is the same everywhere. PostgreSQL and SQLite are free and good for practice.
- Can my agent run my queries? Yes. It runs them on the practice database in its workspace and compares the result with the expected answer. It does not connect to your company's database.
- Is SQL enough to get a data analyst job? SQL is usually the core skill, combined with Excel or a BI tool and basic statistics. Strong SQL alone gets you through many technical screens.
JavaScript is required to use the todo.is app.