← All SQL interview questions

Zero-filled daily sales grid for every store

MediumJoins — Cross JoinWalmartTarget

A regional manager wants a complete store-by-day sales grid for the week of 20 to 24 October 2026. Days on which a store sold nothing must still appear, with sales of 0.

Using stores, report_days and daily_sales, return store_name, report_date and sales_amount (total sales for that store and day, 0 if none). Order by store_name, then report_date.

Sample data

Table: stores

4 row(s)

store_idINTstore_nameTEXT
1Whitefield
2Indiranagar
3Koramangala
4Jayanagar

Table: report_days

5 row(s)

report_dateDATE
2026-10-20
2026-10-21
2026-10-22
2026-10-23
2026-10-24

Table: daily_sales

12 row(s) · showing first 8

sale_idINTstore_idINTsale_dateDATEsales_amountNUMERIC(10,2)
112026-10-2042000.00
212026-10-2138500.00
312026-10-2351000.00
422026-10-2029000.00
522026-10-206000.00
622026-10-2233000.00
722026-10-2447500.00
832026-10-2122000.00

Practising alone only goes so far — our live cohorts pair SQL depth with dashboards, agentic analytics projects and mock interviews.

Explore the program