Mockbit/#48
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
← Back homemockbit.io/q/48
PrivacyTerms© 2026 Mockbit