Magicsheet logo

Product Sales Analysis I

Easy
66.5%
Updated 6/1/2025

Product Sales Analysis I

What is this problem about?

The Product Sales Analysis I SQL problem asks you to find the product name, year, and price for each sale record by joining the Sales table with the Product table. This easy SQL problem tests basic JOIN and column selection. The database interview pattern is demonstrated at its most fundamental.

Why is this asked in interviews?

Microsoft, Meta, Amazon, Google, and Bloomberg ask this as a quick JOIN verification problem. It tests that candidates know how to join two tables on a foreign key and select the appropriate columns.

Algorithmic pattern used

Simple JOIN. SELECT p.product_name, s.year, s.price FROM Sales s JOIN Product p ON s.product_id = p.product_id.

Example explanation

Sales: (1,prod1,2008,10.00), (1,prod1,2009,20.00). Product: (prod1,"Nokia"). Result: [("Nokia",2008,10.00),("Nokia",2009,20.00)].

Common mistakes candidates make

  • Selecting product_id instead of product_name (must join to get the name).
  • Using WHERE instead of JOIN condition.
  • Confusing which table has which column.
  • Not aliasing tables clearly when column names overlap.

Interview preparation tip

Product Sales Analysis I is the simplest JOIN problem. Master the pattern: identify the join key, select columns from both tables, write FROM table1 JOIN table2 ON condition. Practice joins with multiple tables progressively: 2-table join → 3-table join → self-join. Product Sales Analysis I through V forms a complete progression of SQL join and aggregation complexity.

Similar Questions