Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Returning tables and sets
Summary
11. Exercise 3

Instruction

Good stuff! Let's move on to the next exercise.

Exercise

Create a new function named get_users_of_three_best_answers() that returns a table with the top three users with the best answers. The result should contain the following columns:

  • user_id int.
  • user_name varchar.
  • count_of_answers bigint.

The final table returned by the function should be sorted by number of answers in descending order and by the ID of user in ascending order.

Stuck? Here's a hint!

You can use RETURNS TABLE along with the RETURN QUERY statement.