题解 | #查找描述信息中包含robot的电影对应的分类名称以及电影数目,而且还需要该分类对应电影数量>=5部#
查找描述信息中包含robot的电影对应的分类名称以及电影数目,而且还需要该分类对应电影数量>=5部
http://www.nowcoder.com/practice/3a303a39cc40489b99a7e1867e6507c5
最后子查询限制一下category_id
就好
select category.name, count(film.film_id) as num from film left join film_category on film.film_id = film_category.film_id left join category on category.category_id = film_category.category_id where film.description like '%robot%' and category.category_id in (select category_id from film f left join film_category fc on f.film_id=fc.film_id group by category_id having count(1)>=5);