Amazon-style Company ChallengeBeginnerVerified answerSQLite live

Product Inventory by Category

List all products in the Electronics category with their price and current stock quantity.

  • Filtering

Challenge brief

Understand the request

Catalog Management needs to audit stock levels for a specific product line before the quarterly review.

List all products in the Electronics category with price and stock levels.

Return

  • product_name
  • price
  • stock_quantity

Constraints

  • Category filter must match exactly: Electronics (capital E)
  • Only the three specified columns should appear

Data you will use

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

products

  • product_nameVARCHAR(200)
  • categoryVARCHAR(100)
  • priceREAL
  • stock_quantityINTEGER

Hints, when you need them

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

Hint 1

All the data you need is in a single table: products. The category column stores the product line as a text string.

Hint 2

Use WHERE category = and match the exact string from the data. Category names are case-sensitive — use Electronics with a capital E.

Hint 3

Scaffold: SELECT the requested catalog fields FROM products and complete an exact category equality predicate.

Verified SQL answer

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

Reveal solution and explanation
SELECT product_name, price, stock_quantity FROM products WHERE category = 'Electronics';

Why this works

A single-table SELECT with a string equality filter. The category column stores plain text, so the match must be exact — "Electronics" not "electronics". Four products qualify.

Success check

4 products — all Electronics items in the catalog

Expected result

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

product_namepricestock_quantity
Wireless Mouse29.99500
USB-C Cable12.991000
Laptop Stand45.99300
Bluetooth Speaker59.99250

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.