RienSQL
Back to notes
NOTE · undefined words

SQL for Data Analysts: Skills, Example Tasks and a Study Plan

SQL for data analysts: the five skills you use weekly, a top-N-per-category example, and a 4-6 week study plan with hands-on practice.

SQL is the skill Thai data teams ask about most in interviews, and it is usually the first technical filter for analyst roles. This guide covers what SQL you actually need as a data analyst, how it is used on the job, and how to practise it before an interview.

Why analysts need SQL

Most company data lives in a database, not in a spreadsheet. Pulling it out means writing queries against MySQL, PostgreSQL, BigQuery or Snowflake. With SQL you answer business questions yourself: why did revenue drop this month, which customers repeat purchases, which campaign actually pays back.

Five SQL skills you use every week

  • SELECT, WHERE, ORDER BY — pull only the columns and rows you need; enough for daily reports.
  • JOIN — combine orders with customers. Knowing INNER JOIN versus LEFT JOIN matters: the wrong one silently loses rows.
  • GROUP BY and HAVING — aggregate revenue by month, channel or category, then filter the groups you care about.
  • Window functions — ranking, running totals and period-over-period deltas with ROW_NUMBER, RANK and SUM OVER.
  • CTEs and subqueries — split a long query into readable steps you can debug one at a time.

A task you will actually get

The classic request is "top 3 products per category by revenue". It needs a GROUP BY first, then ROW_NUMBER() OVER (PARTITION BY category ORDER BY revenue DESC) to rank inside each category.

WITH sales AS (
  SELECT category, product_id, SUM(qty * price) AS revenue
  FROM order_items
  GROUP BY category, product_id
)
SELECT category, product_id, revenue
FROM (
  SELECT *, ROW_NUMBER() OVER (PARTITION BY category ORDER BY revenue DESC) AS rn
  FROM sales
) ranked
WHERE rn <= 3;

Interviewers like this pattern because one query tests aggregation, grouping and window functions at once.

A realistic study plan

From zero to job-ready usually takes four to six weeks. Work through the free SQL course lesson by lesson, then solve two or three tasks a day in the SQL trainer with solutions. Continue with the data analysis course, which uses the same kind of tasks you meet at work.

For interview prep, review the SQL interview questions with answers and practise explaining your reasoning out loud, not just getting a query that runs.

Start now

Every exercise runs in the browser against a real database, so there is nothing to install. Open the SQL landing page or jump straight into the trainer.

Article contentWhy analysts need SQLFive core skillsA real taskStudy planStart now

Python Academy