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 / 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 |
Explain Type juggling?
what is the difference between php and my sql
What is strcmp () in php?
How can you create a session in php?
How will you create a bi-lingual site (multiple languages) ?
Tell me what type of operation is needed when passing values through a form or an url?
Where is php code written?
Which functions are used to count the total number of array elements in php?
What are the benefits of using php?
How can we submit a form without a submit button?
What is php mean?
Is variable name casesensitive in php?