Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialUnsubscribed User
8,428 PointsI don't understand the question or JOINS
JOINS haven't really been covered so far in this track but here I am expected to do one after a 4 minute example. I am not really even sure what the exercise is trying to get me to do honestly. Any help would be great. Thanks.
1 Answer
aziztovbaev
23,252 PointsIt doesn't specify if it's left join with the Genres table. Since it states use Media_Genres table to join two tables, so I think we should understand that first two tables are joined - Media and Media_Genres, and now we will join the third, Genres, table but only if Media_Genres table has similar column with Genres. We have to understand this way, like it's being optional data from Genre if certain conditions meet on first and second tables. It's left outer join of Genres table; some of the data from Genres table will not be listed in a new created table. Also, WHERE clause should be included, and it should be the query from the main table, Media table.
select * from Media join Media_Genres on Media.media_id = Media_Genres.media_id left outer join Genres on Media_Genres.genre_id = Genres.genre_id where Media.media_id=3;
Unsubscribed User
8,428 PointsUnsubscribed User
8,428 PointsThank you. Your explanation helped me understand a bit more and your code even more. I appreciate your time helping me learn.