Sql嵌套查询
此题目出自牛客:https://www.nowcoder.com/practice/2f2e556d335d469f96b91b212c4c203e?tpId=82&&tqId=29782&rp=1&ru=/ta/sql&qru=/ta/sql/question-ranking
以及中间表
问题描述:
你能使用子查询的方式找出属于Action分类的所有电影对应的title,description吗
select title,description
from film
where film_id in
(select film_category.film_id from category
left join film_category
on film_category.category_id=category.category_id where name="Action")
拓展:left join、right join 、inner join
inner join :取交集
left join 以 此关键字左边的表为主表,并全显示主表列(结果如下)
right join 以 此关键字左边的表为主表,并全显示主表列
我宝给我讲的~~
又向我宝靠近一步~
开心~