How to perform this task in 1 single, efficient mysql query? -
I have a list of 1 TV show stored in the table. Another table stores show genres (action, romance, comedy)
Most shows usually have more than 1 style, so there is no option by having a single TV_engier column and entering the style id.
I can create a look-up table that will store the TV Shows ID + Gene ID, and I can add 1 row for each style associated with the show.
Where things get fuzzy for me, when I want to produce a list of shows on the index, and the name of the style associated with the TV show, how do I add 3 tables in 1 skillful query (index But instead of getting your style instead of running different queries for each item).
For the purposes of this post, the tables are as follows
TV show table - tv_id - tv_name Genre Table - genre_id - genre_name
Thanks!
JOIN The heart of SQL will air with something like you
Select from tv_webs tv_vname, genre_name, join show_genres to join the TV show tvshows.tv_id = shows_genres.tv_id joining genres.genre_id = show_genres.genre_id
Comments
Post a Comment