I have a table called “games” in which will have games.id, games.name and games.modus fields. I know the ID should be auto increnment and integer, games.name a text value and the problem is I don’t know what to make games.modus, because it will have “multiple options”, another tables called “modes” will be created with modes.id and modes.name, the modes.name will have the following rows: “Singleplayer”,”Multiplayer”,”LAN”,”Online”,”LAN Co-op”,”Online Co-op”,”Offline Co-op”,
and I need to be able to select multiple of those rows into the “games.modus” field. How would I achive this?
I have a table called games in which will have games.id, games.name and games.modus
Share
What you are describing is an N-to-N relationship. You need to model a third table so that you can have an 1-to-N and an N-to-1 relationship. N-to-N cannot be modeled otherwise, to my knowledge.
In your case, that means that you would need a table like modes_per_game which would contain a foreign key to the game id and to the mode id. If you want to make the result a bit more friendly then a simple query and form will do the job but it has to be structured with a middle table to make the links.