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 trialPhiona Basemera
2,400 PointsThe library database contains a Media table with the columns media_id, title, img, format, year and category. It also co
The library database contains a Media table with the columns media_id, title, img, format, year and category. It also contains a Genres table with the columns genre_id and genre. To join these tables, there is a Media_Genres table that contains the column media_id and genre_id
Add to the following SELECT statement to JOIN the Media table and the Genres table using the joining table Media_Genres.
SELECT * FROM Media WHERE media_id=3;
2 Answers
ivana kantnerova
15,932 PointsSELECT * FROM Media inner join media_genre on media.media_id = media_genre.media_id inner join genres on genres. genre_id = media_genre.genre_id WHERE media_id=3;
KRIS NIKOLAISEN
54,972 PointsSlight correction of Ivana's post
SELECT * FROM Media INNER JOIN Media_Genres on Media.media_id = Media_Genres.media_id INNER JOIN Genres on Genres.genre_id = Media_Genres.genre_id WHERE Media.media_id=3;
The table is Media_Genres plural and the table name was added to the WHERE clause for disambiguation