Ask Claude about this

Products Without Reviews Analysis

Business Context

At Apple, product reviews play a crucial role in our customer feedback loop and influence purchasing decisions. Identifying products that haven't received any customer reviews helps our Product Marketing and Customer Experience teams prioritize their efforts to solicit feedback. This analysis enables us to take proactive measures to gather customer insights for products that might be flying under the radar, allowing us to better understand customer satisfaction and identify potential issues early.

Technical Requirements

The primary objective is to develop a PostgreSQL query for the following:

Task: Find all products that haven't received any reviews.

Criteria:

  • A product is considered to have "no reviews" if there are no entries for its product_id in the Reviews table.
  • The output should include the product_id and product_name.
  • Sort the results by product_id in ascending order.

Database Schema

-- Table: Products
CREATE TABLE Products (
    product_id INT PRIMARY KEY,
    product_name VARCHAR(255) NOT NULL,
    price DECIMAL(10, 2),
    category VARCHAR(100)
);

-- Table: Reviews
CREATE TABLE Reviews (
    review_id INT PRIMARY KEY,
    product_id INT,
    user_id INT,
    rating INT -- Assuming rating is between 1 and 5,
    review_date DATE,
    FOREIGN KEY (product_id) REFERENCES Products(product_id) 
        -- Assuming a Users table exists for user_id FOREIGN KEY if needed
);

Sample Data for Products Table:

product_id product_name price category
101 iPhone 13 799.99 Smartphone
102 MacBook Air 999.99 Laptop
103 AirPods Pro 249.99 Audio
104 iPad Mini 499.99 Tablet
105 Apple Watch 399.99 Wearable

Sample Data for Reviews Table:

review_id product_id user_id rating review_date
1 101 1 5 2023-01-15
2 102 2 4 2023-01-20
3 103 3 5 2023-01-25
4 101 4 4 2023-02-05

Expected Output (based on sample data):

product_id product_name
104 iPad Mini
105 Apple Watch

Products Lacking Reviews

EASY

Write a PostgreSQL query to list all products (product ID and name) that have not received any customer reviews. Sort the results by product ID.

Your Turn! What are your thoughts on this problem or alternative ways to solve it? Share your own SQL query attempts or insights in the comments below!

Nerchuko Academy · Free DS Interview Prep