SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

Valid Promotion Order Share

Unsolved

The promotions team wants to know how many orders really used an active promotion. An order used a valid promotion when its promo_id exists in promotions and the order_date falls between that promotion's start_date and end_date, both inclusive. Orders without a promo_id, with an unknown promo_id, or with a promotion that was not running that day do not count, but every order is part of the total. Write an SQL query that returns a single column, valid_promo_pct, rounded to 2 decimal places.

SQL Query Editor (Ctrl+Enter to run)
0 characters · Valid
Canonical Solution Official

Official Solution is Hidden

Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.

Community Q&A & Discussion

Ask questions, share alternate queries, and explore solutions

0 comments
Asked By:
🏢 Meta

Submission History

Your recent query executions and answer checks

Execution Pipeline:
FROM promotions
Full source dataset
3 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine