
Number Guessing Game
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) For the guessing game algorithm, let us consider that some users have played the game and we got their result. The results are put in a database with the parameters like user id, username, 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. For testing purposes i'm using select *. select * from leaderboard ; Now to sort it based on difficulty, we can make use of the order by clause. I want the list in descending order so i will use order by column_name desc in my syntax. select userid , difficulty , attempts from leaderboard order by difficulty desc , attempts ;
Continue reading on Dev.to Beginners
Opens in a new tab




