SQL Basics for PMs
Part of the Product Management Roadmap
In short
Waiting two days for an analyst to answer "how many orders came from Pune?" slows everyone down. A little SQL lets you answer your own questions in minutes.
Enough SQL to pull your own data without waiting on an analyst — SELECT, WHERE, GROUP BY, JOIN and basic aggregate functions cover the vast majority of a PM's real needs.

Think of it like this
Asking the librarian
You tell the librarian: "Give me books by this author, only from after 2020, newest first, just the top five." She checks the catalogue and hands them over. SQL is that same request, written so a database understands.
Watch it happen
One question, one query
FROM orders
1/6Start by choosing the table. Here, every order ever placed, one row per order.
The big ideas
What you need to know
Tables are spreadsheets
Rows are records, like one order each. Columns are fields, like city and amount.
WHERE filters rows
Keep only the rows you care about before counting anything.
GROUP BY summarises
Combine rows into groups, then use COUNT, SUM or AVG on each group.
JOIN connects tables
Orders store a user_id. A JOIN pulls in that user's details from the users table.
See it in code
Walk through the code
1SELECT city,2 COUNT(*) AS orders,3 ROUND(AVG(amount), 0) AS avg_order4FROM orders5WHERE created_at >= '2026-01-01'6GROUP BY city7ORDER BY orders DESC8LIMIT 5;1/4Pick the columns to show: city, an order count and the average amount.
Top five cities by orders this year, with the average order value. This runs in PostgreSQL, MySQL and most SQL tools.
Save yourself the pain
Common mistakes
Oops
Running SELECT * on a huge table with no LIMIT.
Do this instead
Add LIMIT while exploring, and select only the columns you need.
Oops
Trusting a number without checking how the query counts.
Do this instead
Spot-check a few rows and ask an analyst to review queries used in big decisions.
Your mission
Answer three questions in SQL
Quick check
You want the number of orders per city. Which clause do you need?
Go deeper
- 1Complete a beginner SQL course or interactive tutorial (many are free).
- 2Practice writing a query to count daily signups from a sample dataset.
- 3Learn just enough JOIN logic to combine a users table with an events table.
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.