database - best way to set up my mysql schema: songs and tags -


greetings.

i have table full of songs full of data (artist, songname, link, etc). want set relationships tags. in end, want search tag , return playlist of relevant songs.

here thinking: (rough pseudo code):

table songs( id int(16) primary index, ... )  table tags ( id int(16) primary index, ... )  table taggedas ( songid int(16), tagid int(16), songid foreign key songs(id), tags foreign key tags(id) ) 

however these seems sucky because whenever want tag have operations on each of 3 tables. if use mongodb (oh wish), store array of tagnames on songs.

also, it'd nice have related tags, don't know if possible design.


Comments