SQL for Data Analysis: SELECT, JOINs, GROUP BY & Aggregations

Cornerstone guide

SQL for Data Analysis: SELECT, JOINs, GROUP BY & Aggregations

2 min readPublished 29 Jul 2026

SQL is the single most requested skill in analyst job ads — it's how you get data out of databases to analyse. This guide covers the analyst's core SQL, and builds on the full Databases & SQL Fundamentals library.

Reuse: For deeper coverage of relational design, keys, transactions, indexes and NoSQL, work through the existing SQL Fundamentals guide and its topics (e.g. JOINs, CRUD, keys & relationships). This guide focuses on using SQL for analysis.

SELECT — getting data

SELECT product, region, sales
FROM orders
WHERE region = 'North' AND sales > 100
ORDER BY sales DESC
LIMIT 10;

SELECT chooses columns, FROM the table, WHERE filters rows, ORDER BY sorts, LIMIT caps rows. This is 80% of day-to-day analyst SQL.

Aggregations with GROUP BY

The analyst's workhorse — summarise data by group:

SELECT region, SUM(sales) AS total_sales, COUNT(*) AS orders
FROM orders
GROUP BY region
HAVING SUM(sales) > 10000
ORDER BY total_sales DESC;

Aggregate functions: SUM, COUNT, AVG, MIN, MAX. GROUP BY collapses rows into groups; HAVING filters groups (unlike WHERE, which filters rows before grouping).

JOINs — combining tables

Data lives in multiple related tables, so you join them on a shared key:

  • INNER JOIN — only matching rows in both tables.
  • LEFT JOIN — all rows from the left table, plus matches (nulls where none) — great for "customers with no orders".
SELECT c.name, SUM(o.sales) AS total
FROM customers c
LEFT JOIN orders o ON c.id = o.customer_id
GROUP BY c.name;

Order of execution (why queries behave oddly)

SQL runs in this logical order: FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY → LIMIT. That's why you can't use a SELECT alias in WHERE, but can in ORDER BY — a favourite interview gotcha.

Put it to work

Practise live in the interactive SQL Fundamentals lab (runs in your browser), then apply it in the Sales Analysis scenario.

Interview Intelligence

How this topic actually shows up in interviews — and how to demonstrate you understand it.

Why employers ask about this

SQL is the most requested analyst skill; interviews almost always include a live query or two.

Technical questions
Write a query for total sales by region, highest first.+

SELECT region, SUM(sales) AS total FROM orders GROUP BY region ORDER BY total DESC;

How would you find customers with no orders?+

LEFT JOIN customers to orders on the key and filter WHERE orders.id IS NULL.

Behavioural questions
Tell me about a time you used SQL to answer a business question.+

Use STAR: the question, the query approach (joins/aggregations), and the insight and decision it enabled.

Real-world scenarios
“You need sales by product category, but products and sales are in separate tables.”+

Expected answer: JOIN the tables on the product key, GROUP BY category and SUM the sales, ordering by total.

Employability Intelligence

Where this knowledge takes you — the jobs, skills and certifications it feeds into.

Relevant roles
Data AnalystBI AnalystReporting Analyst
Skills you're proving
SQL SELECTGROUP BYJOINsAggregations
Recommended certifications
Microsoft Power BI (PL-300)Google Data Analytics
Career progression

Essential for every analyst and data-engineering career.

What employers expect

That you can clean, analyse and visualise real data, write SQL, and turn findings into clear, actionable recommendations for the business.

Frequently asked questions

What is the difference between WHERE and HAVING in SQL?

WHERE filters individual rows before grouping; HAVING filters groups after GROUP BY (e.g. groups whose total exceeds a threshold).

What is the difference between INNER JOIN and LEFT JOIN?

INNER JOIN returns only rows with a match in both tables; LEFT JOIN returns all rows from the left table plus matches, with nulls where there's no match.

What SQL do I need as a data analyst?

SELECT/WHERE/ORDER BY/LIMIT, aggregations with GROUP BY/HAVING, and INNER/LEFT JOINs — that covers most day-to-day analyst work.

Related guides

Practise what you've learned

Turn this guide into real, evidenced progress

Missiora helps you measure, improve and evidence the capabilities employers actually value — start with the tools best suited to this topic.

M
Published by
Missiora

Missiora is an AI Employability Intelligence platform. Our resources are researched and reviewed by the Missiora team to help you measure, improve and prove your career readiness.