Quick Commerce Analytics Path · Mission 5 of 25Easy

Dispatch timing distribution

Extract the hour-of-day from a timestamp and count dispatches per hour. Practice EXTRACT and grouping on a derived value to read a demand curve.

Back to Quick Commerce Analytics

The Brief

Sam OkaforOperations Leadops

Staffing planning. I need to see when dispatches actually happen across the day. From fact_shopper_dispatches, pull the hour of dispatch_ts and count dispatches in each hour. Columns: dispatch_hour, dispatch_count. ORDER BY dispatch_hour.

You'll practice

Date arithmeticGROUP BY hourCOUNT

Tables & columns available

fact_shopper_dispatchesfact10 columns
ColumnTypeKey
dispatch_idINTPK
shopper_idINTFK → dim_shoppers
dispatch_tsTEXT
pickup_tsTEXT
deliver_tsTEXT
batch_sizeINT
pick_to_deliver_minutesINT
dispatch_statusTEXT
total_distance_miREAL
shopper_payoutREAL

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

dispatch_ts is a TEXT timestamp; cast it before extracting the hour.

Hint 2

EXTRACT(HOUR FROM dispatch_ts::timestamp) gives the 0-23 hour.

Hint 3

GROUP BY that hour, COUNT(*) as dispatch_count, ORDER BY dispatch_hour.