Top 3 Most Expensive Items

ASKED IN INTERVIEW
2pts
e Bay

Problem Statement

eBay analysts want to feature the most premium electronics on the homepage. Write an SQL query to find the three most expensive items in the Electronics category.

Rules:

  • Only include items from the Electronics category.
  • Output columns: item_name, price.
  • Results must be sorted by price in descending order.
Tests your understanding of
Ranking, Filtering and Sorting

Input Tables

Items
item_id(INTEGER)item_name(VARCHAR)category(VARCHAR)price(DECIMAL)
1LaptopElectronics1200
2SmartphoneElectronics800
3HeadphonesElectronics150
4MonitorElectronics300
5Desk LampHome45
Sellers
seller_id(INTEGER)item_id(INTEGER)rating(DECIMAL)
10114.8
10224.5
Stock_Log
item_id(INTEGER)quantity(INTEGER)
110
225

Expected Output

item_name(VARCHAR)price(DECIMAL)
Laptop1200
Smartphone800
Monitor300

Tags

EasyASKED IN INTERVIEWRankingFilteringSorting
5-10 min
85%

Hints