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.



we store and display scores of users in different games. In MySQL, records are stored as tuples (us..

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

Post New Answer

More PHP Interview Questions

How to check a variable is array or not in php?

0 Answers  


hello.. i am b.tech 4th year student. i am confused that i should learning php or java. I have some knowledge of java and developed project in java, but i want to develop my career in php. So plz suggest me , i should go with php or java.

5 Answers  


What is the content of /etc directory?

0 Answers  


Why did you choose this particular career path?

0 Answers  


What are the new features in php 7?

0 Answers  






Why does php start with variables?

0 Answers  


How to remove the new line character from the end of a text line in php?

0 Answers  


What is inheritance in php progaming?

1 Answers  


Can we use get instead of post?

0 Answers  


What is the use of @ in php?

0 Answers  


How to add comments in php?

0 Answers  


Why do we use session?

0 Answers  


Categories