答案
select title, description from film where film_id in ( select fc.film_id from category c, film_category fc where c.category_id = fc.category_id and c.name = 'Action'/*查询action分类的电影id*/ );
思路
- 查询action分类的电影id
select fc.film_id from category c, film_category fc where c.category_id = fc.category_id and c.name = 'Action'
- 查询电影id在1中的电影title,description
优化
可以完全不用join,使用3个子查询解答
select title, description from film where film_id in ( select film_id from film_category /*查询action分类的film_id*/ where category_id in ( select category_id from category where name = 'Action'/*查询action分类的category_id*/ ) );