database design - mysql: how to write a table of views -


i think question best explained via example: suppose want write webserver streaming music. have following columns in songs table: |song_id|song_name|song_genre|song_length|artist

i enable users save playlists, don't want playlists defined explicitly specifying songs in playlist, rather "all songs ringo starr", mean when new songs ringo starr added table, playlist automatically have them. want table called playlists contains list of mysql views.

the naive approach have table called playlists, , 1 of it's columns called playlist_query store above example string "select song_id songs artist='ringo starr'.

this of course incredibly insecure, suffice in case there no better solution, since application used internaly inside our company few employees programmers know way around mysql.

so suggest? go ugly solution, or there easier way this?

you store name of view in playlists table instead of query itself.

you'd still have create required views though , don't know how helps "security problem".

could elaborate on kind of security required?


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -