we store and display scores of users in different games. In
MySQL, records are stored as tuples (user-id, game-id, score).
Now we need to support ranks of users, i.e., each user
should be informed of his current rank in the community. The
challenge is to come up with the best way to store the data
in MySQL so that the requirements are efficiently met.
Answer Posted / amitverma
There's NO need to store the data in any "new" way because
the existing schema/tuple (user-id, game-id, score) is
enough for fetching and displaying the ranks of individual
users. Only need is to write few good SQL queries which
will do the job. We can display ranks as follows -
Select user-id, score from game_table where game-id='10'
order by score.
Note - The above SQL query will display the rankwise
listing of users (as per their scores) for a specific game,
which has id 10 (say cricket).
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
How to call a php function from html button?
What are the different types of PHP arrays?
What is difference between core php and framework?
In php, objects are they passed by value or by reference?
Explain PHP looping?
What are the benefits of composer?
How can cross site request forgery csrf be prevented?
How is csrf token generated?
What does $globals means?
What is compact function php?
Do I need to install php after xampp?
Is nan in javascript?
What is the difference between == and === in php?
What does session start do in php?
What is difference between session_unset and session_destroy?