Loading exercise…
Loading exercise…
Exercises are built for a keyboard. Read the task here, then open this page on a laptop to solve it.
Subquery in FROM. A subquery in FROM acts like a temporary table, often called a derived table. Build one row per thing you care about inside it, give it an alias, then group or filter it outside. It's the same idea as a WITH block, written inline.
select segment, round(avg(days_before_2025), 1) as avg_days from ( select segment, date '2025-01-01' - signup_date as days_before_2025 from customers ) t group by segment
Elena Petrova is planning account-manager cover and asks how much a typical buying customer spends in a year, per segment.
Return segment, customers (the number of customers with at least one completed order) and avg_customer_revenue (the average of each customer's total completed revenue, 2 decimals).
Loading the Brightline dataset…
Language
Full plan
SQL ✓ · Excel and Power BI also included
Cancel anytime · 14-day full refund · Secure payment by Stripe