Clients aged 40–55 on May 31, 2025: Казань
Level: Junior50 XP
Instructions
A client's age on May 31, 2025 is the number of full years between birth_date and that date (age(May 31, 2025, birth_date), years only). Consider clients from the city 'Казань' (clients.city) whose age on that date is from 40 to 55 years inclusive. Group them by segment (clients.segment) and output segment, clients_cnt, the number of clients, and avg_age, the average age on that date, rounded to 1 decimal place. Do not output segments without matching clients. Row order does not matter.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Exactly oneZero or oneZero or more
Table relationships
- N:1Many-to-one
accounts.→client_id clients.id - N:1Many-to-one
transactions.→account_id accounts.id
Table data
PostgreSQL
Select a table in the diagram or list to view its rows.