I want to store a variable size list of image tags in a SQL database and then be able to search the database for images based on the tags. I am currently pulling the tag lists out of the database, and checking if the query tag is contained in the array. Is there any way I can format these as sql queries instead of doing them in php after I pull the tags out?

The list is stored as comma separated values of the form:

"sunny, beach, palms" -im1

"palms, rainy, clouds" -im2

"winter, snow, snowman, swag" -img

I would like to be able to get the union of the query tags:
A query of "beach, palms" should return im1 and im2

Thanks