How do I organize tables for simple lottery game? mysql [closed]

Posted on

Question :

I am building a simple lottery web game that will let users pick a number that is in between that weeks given range. A number will be randomly select to determine the winner. I have a table for users (id, username, password, pin, funds) but as I go to setup the games table I get kinda stumped. How do I keep track of what numbers have been picked so far and who they belong to? game (id, date, winner…)? How do I handle the fact that the number range can change from week to week?


  • id
  • username
  • password
  • pin
  • funds


  • id
  • date
  • winner


  • date
  • range


  • date
  • user_id
  • number

Is this heading in the right direction?

Answer :

I’d create another table to store the number range each week (store the date and range) and then another table to store the user’s selection (store the user id, date, and chosen number).

Leave a Reply

Your email address will not be published. Required fields are marked *