SQLeasyAggregations~12m
FitZone gym chain wants to analyze member workout frequency to identify their...
Problem
FitZone gym chain wants to analyze member workout frequency to identify their most dedicated members for a loyalty program. Calculate the total number of workouts completed by each member in the last 30 days (from 2024-01-31), along with their average workout duration in minutes. Only include members who completed at least 5 workouts in this period. Order results by total workouts descending, then by member_id ascending for ties.
Examples
Example 1
Example 2
Constraints
- ›Return columns: member_id, name, total_workouts, avg_duration_minutes
- ›Only include members with at least 5 workouts in the 30-day period
- ›Handle NULL duration values by excluding them from average calculation
- ›Order by total_workouts DESC, then member_id ASC for ties
- ›Round avg_duration_minutes to 1 decimal place
Reference solution
Reference solution available after you attempt the question.
Ready to solve it?
Start a session on Mockbit #48. Write your SQL, run it against real data, and get graded on correctness, efficiency, query structure, and business understanding.
Related SQL questions
- #41You're analyzing user engagement for a social media platformeasy
- #43A regional bank wants to analyze account activity by branch locationeasy
- #44A medical clinic wants to identify patients who have been prescribed medications...easy
- #42A video streaming platform tracks user viewing sessionshard
- #45A mobile gaming company wants to identify the top 3 most active players for each...easy
← Back homemockbit.io/q/48