← All questions
Technicalstandard
Write a SQL query to find the top 10 customers by number of orders last month, and explain how you would check the result.
How to approach it
Say the query in words first: filter orders to last month, group by customer, count, sort, take ten. Then name the traps.
How a strong answer opens
“In words: filter orders to last month, group by customer, count the orders, sort highest first and take the top ten. Then I'd check for canceled orders, test accounts and time zones.”
Outline of a strong answer
Try answering out loud for a few minutes before you open this.
- Filter the orders table to last month's date range
- Group by customer ID and count orders
- Sort by the count, highest first, and limit to 10
- Join to the customers table if names are needed
- Check: canceled orders, test accounts, time zones
- Sanity-check the totals against a known dashboard
Where this question usually goes wrong
Writing the query without defining last month, or skipping checks for canceled orders, test accounts and ties at tenth place.
Learn the method
Data and databases in Module 6, Technical for PMs.
The full kit has worked answers in full, start to finish, for every round type. $129 once.
More technical questions
- Explain the difference between SQL and NoSQL databases, and when you'd pick each.
- Your checkout went down for an hour. What do you do during the outage and after it?
- What happens when you type a URL into a browser and press Enter?
- Explain what an API is to someone who isn't technical.
- What's the difference between REST and GraphQL, and when would a PM care?