Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Daily or Regional Aggregations

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Daily or Regional Aggregations. Start with the requirements and the one table on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Shopee's operations team needs a daily view of completed marketplace orders and gross merchandise value, or GMV, for 1 to 5 June 2025. Write a PostgreSQL query using the shopee_orders table.

Requirements

  1. Include only orders with order_status = 'COMPLETED' and an order_date from 1 June through 5 June 2025, inclusive.
  2. Return one row per order date with the completed order count and total GMV. Treat a missing order_amount as zero in the total, and sort by date ascending.

Schema

shopee_orders
ColumnTypeDescription
order_idPKINTUnique order identifier
order_dateDATEDate the order was placed
order_statusVARCHAR(20)Current order status
order_amountDECIMAL(10,2)Order GMV in Singapore dollars
Tablesshopee_orders
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results