题解 | #查找描述信息中包含robot的电影对应的分类名称以及电影数目,而且还需要该分类对应电影数量>=5部#
查找描述信息中包含robot的电影对应的分类名称以及电影数目,而且还需要该分类对应电影数量>=5部
http://www.nowcoder.com/practice/3a303a39cc40489b99a7e1867e6507c5
select c.name, count(*) from film as f inner join film_category as fc on f.film_id = fc.film_id inner join category as c on fc.category_id = c.category_id left join ( select c.category_id, count(*) as count from film as f inner join film_category as fc on f.film_id = fc.film_id inner join category as c on fc.category_id = c.category_id group by c.category_id ) as fcg on c.category_id = fcg.category_id where f.description like '%robot%' and fcg.count >= 5 group by c.category_id