COUNT with date range filter
How many contracts in `dim_contracts` are active as of 2025-06-01? Active means today is between start_date and end_date.
| Column | Type | Key |
|---|---|---|
| contract_id | INT | PK |
| supplier_id | INT | FK → dim_suppliers |
| category_id | INT | FK → dim_categories |
| start_date | TEXT | |
| end_date | TEXT | |
| contracted_unit_price | REAL | |
| discount_threshold_qty | INT |
Each hint you reveal reduces the XP you can earn. Try the query first.
A contract is active when today's date falls inside its window — there's a SQL operator for 'falls between two values'.
Use COUNT(*).
Alias as active_contract_count.