Data Analyst · Step 3 of 8 · 12 min

SQL basics

You can write queries that filter, group and join tables, and practise for free online.

01 · Why SQL beats copy-paste

Company data lives in databases, often far too large for a spreadsheet. SQL (Structured Query Language) is how you ask a database for exactly the rows and totals you need. It is the most requested skill in analyst job ads.

A query is also a written record. Anyone can rerun it next month and get the same logic, which is much safer than a chain of manual copy, paste and filter steps nobody can repeat.

02 · SELECT, FROM, WHERE

The basic shape: SELECT the columns you want, FROM a table, WHERE a condition is true. For example: SELECT order_id, amount FROM orders WHERE order_date >= '2026-01-01'. Add ORDER BY amount DESC to sort, and LIMIT 10 to see the top ten.

Start every new table with SELECT * FROM table LIMIT 10 to see what the columns actually contain before you write anything clever.

03 · GROUP BY: totals by category

GROUP BY is the SQL version of a pivot table. SELECT region, COUNT(*) AS orders, SUM(amount) AS revenue FROM orders GROUP BY region gives one row per region.

Use WHERE to filter rows before grouping and HAVING to filter the groups afterwards, for example HAVING SUM(amount) > 10000.

04 · JOIN: combining tables

Databases split data across tables: orders in one, customers in another, linked by an ID. JOIN brings them together: FROM orders o JOIN customers c ON o.customer_id = c.id.

An inner JOIN keeps only rows that match on both sides. A LEFT JOIN keeps every row from the first table, with blanks where there is no match. Compare row counts before and after any join; a sudden jump usually means duplicate keys are multiplying rows.

05 · Where to practise for free

SQLBolt has short interactive lessons in the browser. Mode’s SQL tutorial walks through real-looking business data. DB Fiddle lets you create small tables and test queries. Google BigQuery has a free sandbox with public datasets, no credit card needed.

Dialects differ slightly (date functions especially), but SELECT, WHERE, GROUP BY and JOIN work almost everywhere.

06 · Try it

07 · Check yourself

After joining orders to customers, you have far more rows than orders. What should you suspect?