I have a database:
id | movie_name | genres
1 | Die Hard | Action, Thriller
2 | Gladiator | Adventure, Action, Drama, History
3 | Harry Potter and the Sorcerers Stone | Fantasy, Adventure, Family
4 | Pearl Harbor | Action, Melodrama, War
1) How I can select unique genres from genres of all database.
I need the next: Action / Adventure / Drama / Family / Fantasy / History / Melodrama / Thriller / War
2) How can I see a movie of a certain genre?
SELECT `movie_name` FROM `movies` WHERE `genre` LIKE ??
But he also can bring not only the drama, but melodrama.
3) How to make a search on a particular genre?
May be:
SELECT `movie_name` FROm `movies` WHERE `movie_name` LIKE `%stone%` AND `genres LIKE 'drama'.
Don’t store a comma-delimited list of attributes in a database column.
Instead, have 3 tables:
Then your problems become much, much simpler.