I was stumped by the last question in today’s interview:
(original picture) Design a database table structure that meets the following business needs:
1. A certain merchant holds a time-limited game lottery. Only users who have played the game for 50 points or above can win the lottery. Each user can participate in multiple events.
2. After the event, a list of lottery records needs to be compiled, including the following:
3. If user A wins 2 times in 10 draws, the list will display 2 entries of user A winning the prize. record; if user B does not win the prize after drawing 8 times, only the lottery record with the highest score of user B in playing the game will be displayed. The lottery results of users A and B finally have three records on the list.
4. Sort in reverse order of recorded time.
5. Meet the page turning requirement every 20 items in the list.
Then I thought it was to examine the sql statement, but the interviewer said not to care about those numbers. The most important thing is the table structure and demand analysis. In the end, I still couldn’t answer. Out, over
蜗牛大人2018-03-15 15:31:04
Three tables, the first one is a record table for each user's game; the second one gives the user's winning record according to the requirements and uses if to determine the highest game record when not winning. This table is used as a lottery record, and the third one Record the lottery records of the event in reverse chronological order and meet 20 page turns