BA Prince the B.A. Subscribe

Home / Topics

SQL for Business Analysts

SQL lets a business analyst answer questions about data without waiting for someone else to run a report. You don't need to become a developer. A few query patterns cover most BA work: pulling a list, filtering it, joining two tables, counting and totalling, and checking the data for gaps and duplicates. These tutorials teach those patterns on the same small shop database, one idea at a time.

Why a BA needs SQL

Requirements are only as good as the data behind them. Before you write "customers can see their last 10 orders", it helps to check how many orders a customer really has. Before sign-off, you can check that a new report's totals match the source. SQL is how you do that yourself, in minutes. It also makes conversations with developers easier, because you can talk about tables, keys and joins in their terms.

A suggested order

Start with SELECT and WHERE: choosing columns and filtering rows. Then joins, which most people find hardest: INNER JOIN first, then LEFT JOIN, then the lesson comparing all join types, and the one on why joins sometimes create duplicate rows. Next come GROUP BY, HAVING and COUNT DISTINCT for summaries. After that, pick what your work needs: CASE WHEN for labels, NULL handling, date filters, subqueries and CTEs, and window functions like ROW_NUMBER, RANK and running totals.

The last group of lessons is the most BA-specific: finding duplicates, finding missing records, profiling a table, data quality checks, validating requirements against data and reconciling totals. These are the queries you will reuse on real projects.

Good habits

Run a COUNT(*) before and after a join; if the number jumps, the join is creating duplicates. Remember that NULL is not equal to anything, not even NULL, so use IS NULL to find it. And SQL dialects differ in small ways (for example LIMIT vs TOP, and date functions), so check which database your company uses before copying a query into it.

The videos

37 videos, in the order we suggest watching them.

SQL for Business Analysts: The 5 Queries You Actually Need SQL SELECT Basics: Get Data Out of a Table (Beginner Tutorial) SQL WHERE Clause: Filter Rows Like an Analyst SQL INNER JOIN Explained With a Simple Example SQL LEFT JOIN: Find Customers With No Orders SQL Joins Explained: INNER vs LEFT vs RIGHT vs FULL How to Join Three Tables in SQL Why Your SQL Join Returns Too Many Rows (One-to-Many Fan-Out) SQL Self Join: Employees and Their Managers SQL GROUP BY Explained (Totals per Category) SQL HAVING vs WHERE: Filter Groups COUNT vs COUNT DISTINCT in SQL SUM, AVG, MIN, MAX in SQL: Summary Stats for a Report SQL ORDER BY and LIMIT: Top 10 Lists SQL CASE WHEN: If-Then Logic in a Query NULL in SQL: Why = NULL Never Works (IS NULL and COALESCE) SQL LIKE and Wildcards: Search Text (Starts With, Ends With, Contains) SQL IN and BETWEEN: Cleaner Filters for Lists and Ranges Filter by Date in SQL (Last 30 Days, Last Month, This Month) Group by Month in SQL: Monthly Totals From Daily Rows SQL Subqueries Explained Simply: Customers Above Average Spend SQL CTE (WITH): Make Long Queries Readable, Step by Step ROW_NUMBER in SQL: Get the Latest Record per Customer Running Total in SQL (Window Functions): Cumulative Sales by Date RANK vs DENSE_RANK in SQL: Rank Salespeople With Ties LAG and LEAD in SQL: Compare to Last Month SQL UNION vs UNION ALL: Stack Two Lists SQL DISTINCT: Remove Duplicate Rows How to Find Duplicate Records in SQL (GROUP BY + HAVING) Find Records Missing From Another Table in SQL (LEFT JOIN, NOT EXISTS) Profile a New Table in SQL in 5 Queries Data Quality Checks in SQL for Business Analysts Use SQL to Check a Business Rule Before UAT Reconcile Report Totals With SQL Percent of Total in SQL: Share of Sales per Region Primary and Foreign Keys in SQL Tables (Explained With a Join) SQL JOIN vs Excel VLOOKUP (Same Idea)