题解 | #使用子查询的方式找出属于Action分类的所有电影对应的title,description#
使用子查询的方式找出属于Action分类的所有电影对应的title,description
http://www.nowcoder.com/practice/2f2e556d335d469f96b91b212c4c203e
步骤解析:
找出属于Action分类的电影id,记为临时表tmp
select fc.film_id from category as c, film_category as fc where c.category_id = fc.category_id and c.name = 'Action'
此时,生成的临时表是多行单列,列的属性为film_id
找出film中出现在tmp中的电影
select f.title, f.description from film as f where f.film_id in ( select fc.film_id from category as c, film_category as fc where c.category_id = fc.category_id and c.name = 'Action' )