Microsoft-style Company ChallengeBeginnerVerified answerSQLite live

Product Catalog with Category

What products does Microsoft offer and what category does each belong to?

  • Sorting

Challenge brief

Understand the request

Product Management needs a full product catalog view including category classification for an internal product overview slide.

List all products with product_id, product_name, and category.

Return

  • product_id
  • product_name
  • category

Constraints

  • Return every catalog product
  • Order by category and product ID

Data you will use

Review the relevant tables before deciding how to join, filter, or aggregate them.

products

  • product_idINTEGER
  • product_nameTEXT
  • categoryTEXT

Hints, when you need them

Open one clue at a time so you still do the reasoning.

Hint 1

All data is in products. SELECT three columns and ORDER BY category alphabetically. No JOIN, no filter.

Hint 2

SELECT product_id, product_name, category FROM products ORDER BY category.

Hint 3

Build question 26 from the required result grain: choose the driving table, add only the joins and filters needed for that grain, then apply aggregation and deterministic ordering.

Verified SQL answer

Attempt the problem first, then compare structure and reasoning—not just syntax.

Reveal solution and explanation
SELECT product_id, product_name, category FROM products ORDER BY category, product_id;

Why this works

Single-table SELECT with ORDER BY. Dynamics (Business) sorts before Azure (Cloud) alphabetically. Note: Dynamics has no subscriptions in the dataset so it appears only in this catalog question.

Success check

4 products — Business (Dynamics), Cloud (Azure), Collaboration (Teams), Productivity (Office)

Expected result

Use this output to verify values, aliases, ordering, and row count.

product_idproduct_namecategory
4DynamicsBusiness
2AzureCloud
3TeamsCollaboration
1Microsoft OfficeProductivity

Learn the concepts behind this answer

Strengthen your understanding with these targeted learning topics:

Continue practicing

SQL Interview Practice

Return to the complete interview preparation experience.