Show an option to get the details from the leaderboard db.
And find a way to sort it based on difficulty and attempts (Either Ascending or Descending)
- Let us consider that some users have played the guessing game and we got their result. The results are in a database with details like user_id, user_name, attempts, difficulty level, time taken to guess.
- To get these details from leaderboard db we can use either * to get all details or select column names.
select * from leaderboard;
- Now to sort it based on difficulty, we can make use of the order by clause. I have written query to display difficulty and attempts in ascending order.
select user_id, difficulty, attempts from leaderboard order by difficulty, attempts;
Top comments (0)