AlgoMaster Logo

Exercise: MIN, MAX

Last Updated: May 12, 2026

1 min read

For this exercise, we will work with below data:

SQL

Exercise 1

Easy

Find the smallest and largest payment amounts in the payments table. Return them as min_amount and max_amount.

SQL

Expected Query

Expected Output

Exercise 2

Easy

Find the earliest and most recent signup dates from the users table. Return them as first_signup and last_signup.

SQL

Expected Query

Expected Output

Exercise 3

Medium

Find the track with the shortest duration. Return the track_idtitle, and duration_seconds. Handle ties by returning all tracks that share the minimum.

SQL

Expected Query

Expected Output

Exercise 4

Medium

Find the user who signed up most recently. Return the username and signup_date.

SQL

Expected Query

Expected Output

Exercise 5

Hard

Find the maximum payment amount. When multiple payments share the maximum amount, return only the most recent one as a tiebreaker. Return the payment_idusernameamount, and payment_date.

SQL

Expected Query

Expected Output