SQLSQL
#21

Aggregate Monthly Revenue and Order Volumes in SQL

EasyFlipkart
Interview Question #21
Asked at Flipkart

Given an `orders` table, write a SQL query to calculate the total revenue and total number of successful orders for each month. Sort chronologically.

Input Table: orders
4 rows preview
order_idorder_dateamountstatus
12026-01-101200success
22026-01-25800success
32026-02-052500success
42026-02-15300cancelled
Expected Output Structure2 rows
order_monthorder_counttotal_revenue
2026-0122000
2026-0212500
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

SQLPostgreSQL 15
Ready to execute

Click "Run Query" or press Ctrl + Enter to test your query.

Output will be verified against the test dataset.

Chat with us