SQL interview questions · By company
Microsoft SQL interview questions
For data analyst and data scientist roles: what candidates report, and how to practice for it.
SQLRep isn't affiliated with or endorsed by Microsoft. This guide summarizes public candidate reports and prep guides (sources below, checked November 2026). The practice questions are original, written in the reported style; they aren't Microsoft's actual questions. Processes change, so confirm details with your recruiter.
What candidates report about the process
- Prep guides report a SQL assessment sent during the data analyst or data science process.
- Fewer first-hand reports are public than for Meta or Amazon, so treat the topics below as indicative.
SQL topics that come up
- Multi-table joins and choosing INNER versus LEFT
- Customers who did all of something (relational division)
- Anti-joins: users of one product who never used another
Practice the reported patterns
Each one runs in real PostgreSQL in your browser, with feedback on what's wrong.
- Active subscriptions and seats per productFor every product in bt_products, return product (its name), active_subscriptions (subscriptions with status 'active') and active_seats (total seats on those subscriptions, 0 if none). Sort by active_seats descending, then product.Pattern: LEFT JOIN · condition in ON · COUNT(column)EasyPro
- Customers who own the whole Security suiteFor every customer with a completed order for every product in the 'Security' category of bt_catalog, return customer (name) and security_orders (their completed order lines for Security products, repeat purchases included). Sort by customer.Pattern: Relational division · HAVING COUNT(DISTINCT)MediumPro
- Sign-ups who skipped Chat in their first 30 daysFor users who signed up through Notes and had no Chat use from their signup_date through signup_date + 30 (both days included), return name, signup_date and first_chat_on (their earliest Chat use of any date, NULL if never). Sort by signup_date, then name.Pattern: Anti-join with a date window · correlated MINHardPro
- Every user and their planReturn username and plan for every user, with plan NULL when the user has no subscription. Sort by username.Pattern: INNER JOIN vs LEFT JOINMediumFree
- Plan behind each purchaseReturn username, plan and purchase_date (the date of the user's purchase event) for every user who has both a subscription and a purchase event. Sort by purchase_date.Pattern: Three-table JOINMediumFree
- Purchase date for every userReturn username and purchase_date (the date of the user's purchase event, NULL if they never purchased) for all users. Sort by username.Pattern: LEFT JOIN · filter in ON vs WHEREMediumFree
- Active in every monthReturn account_id and everyday_spend (total groceries and dining spend in Q1) for accounts with at least one groceries or dining transaction in each of January, February and March 2024. Sort by account_id.Pattern: COUNT(DISTINCT month) · relational divisionMediumPro
- Bought oat milk, never coffee beansReturn the username of every shopper who has bought oat milk at least once and has never bought coffee beans in any basket, each shopper once, sorted by username.Pattern: EXISTS · NOT EXISTS · per-customer anti-joinMediumPro
- Feature adoption across active workspacesFor March 2025, return feature (each event_name except 'login'), workspaces (distinct accounts that used it) and adoption_pct (workspaces as a % of all accounts active in March, rounded to 1 decimal). Sort by adoption_pct descending, then feature.Pattern: COUNT(DISTINCT) · scalar denominator · timestamp rangesMediumPro
Tip: Joins are where most wrong answers come from: check row counts before and after every join.
Sources
Microsoft is a trademark of its owner, used here only to identify the company the reports are about.