Stop 05 · Data Analysis for Business AnalystsTopics · 3/10

SQL Basics for BAs

Part of the Business Analyst Roadmap

In short

Waiting three days for an analyst to pull 'just one quick number' gets old fast. With basic SQL, you ask the database yourself and get the answer before your chai cools down.

Enough SQL to pull your own data without waiting on an analyst — SELECT, WHERE, GROUP BY, and basic JOINs cover most of a BA's real needs, especially in IT and Data BA roles.

The purple blob hands a request slip across a library counter in front of tall bookshelves.

Think of it like this

Asking the library clerk

You tell the clerk: from the history shelf, only books after 2020, grouped by author, show me authors with more than five books, sorted by count. The clerk does the walking. SQL is that request, written so the database can follow it exactly.

Watch it happen

The order a database runs your query in

FROM/JOIN
WHERE
GROUP BY
HAVING
SELECT
ORDER BY

1/6First, the database picks the tables and joins orders to customers on customer ID.

The big ideas

What you need to know

SELECT and FROM

Say which columns you want and which table they come from. That's already a working query.

WHERE filters rows

Keep only the rows you need, like orders this year or tickets with status 'Open'.

GROUP BY summarises

Combine with COUNT, SUM or AVG to get totals per city, per month or per product.

JOIN connects tables

Match rows from two tables using a shared ID, like orders and customers linked by customer_id.

See it in code

Walk through the code

sql
1SELECT c.city,2       COUNT(o.id)   AS orders,3       SUM(o.amount) AS revenue4FROM orders o5JOIN customers c ON c.id = o.customer_id6WHERE o.order_date >= '2026-01-01'7GROUP BY c.city8HAVING COUNT(o.id) > 1009ORDER BY revenue DESC10LIMIT 5;

1/4Start reading here: join orders to customers, then keep only orders from 2026.

Top five cities by revenue this year, counting only cities with over 100 orders. This one query covers most of what BAs use day to day.

Save yourself the pain

Common mistakes

Oops

Running queries on the live production database without asking.

Do this instead

Use a read-only reporting copy if there is one, and add LIMIT while exploring.

Oops

Using WHERE to filter on a COUNT or SUM.

Do this instead

WHERE filters rows before grouping. Use HAVING to filter on totals after GROUP BY.

Your mission

Query a practice database

~40 min

Quick check

You want cities with total revenue above 5 lakh. Where does that condition go?

Go deeper

  1. 1Complete a beginner SQL course or interactive tutorial (many are free).
  2. 2Practice writing a query to summarize data from a sample table.
  3. 3Learn enough JOIN logic to combine two related tables for a richer analysis.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge