Bid History

ASKED IN INTERVIEW
2pts
e Bay

Problem Statement

eBay needs to display the "Current High Bid" for active auctions. An auction is considered active if the current time is strictly less than the item's expiry date.

Write an SQL query to find the highest bid for item_id 701, provided the item has not yet expired.

Rules:

  • The current timestamp is 2026-02-12 19:06:33.
  • Only consider bids for item_id 701.
  • The item is valid only if its expiry_date > '2026-02-12 19:06:33'.
  • Output columns: item_id, highest_bid.
  • Return the result in descending order of highest_bid.

Table Schema:

  • Items: item_id, item_name, expiry_date (TIMESTAMP).
  • Bids: bid_id, item_id, user_id, bid_amount (DECIMAL), bid_time (TIMESTAMP).
Tests your understanding of
Basic SQL, Aggregation, DateTime and Filtering

Input Tables

Items
item_id(INTEGER)item_name(VARCHAR)expiry_date(TIMESTAMP)
701Vintage Camera2026-02-15 12:00:00
702Old Watch2026-02-10 10:00:00
Bids
bid_id(INTEGER)item_id(INTEGER)bid_amount(DECIMAL)
1701150
2701175.5
3701160
4702300
5701180.25
6701140

Expected Output

item_id(INTEGER)highest_bid(DECIMAL)
701180.25

Tags

EasyASKED IN INTERVIEWBasic SQLAggregationDateTimeFiltering
5-10 min
82%

Hints