okay, so you have a table called games
presumably it's got a column called game_id
now what you want is another table like this --
Code:
CREATE TABLE game_tags
( game_id INTEGER NOT NULL
, tag VARCHAR(99) NOT NULL
, PRIMARY KEY ( game_id , tag )
, INDEX reversi ( tag, game_id )
);
to populate this table, insert one row for each tag that a particular game has...
Code:
INSERT INTO game_tags VALUES
( 9 , 'rpg' )
,( 9 , 'easy' )
,( 9 , 'nintendo' )
,( 37 , 'crossword' )
,( 37 , 'difficult' )
get the idea? game 9 has three tags, game 37 has two
one row per tag, as spacephoenix suggested
the primary key ensures you cannot assign the same tag to the same game more than once
the reversi index is used to make search queries based on tags efficient
Bookmarks