连接查询
-- inner join
-- left join
-- right join
-- full join
子查询
-- where子句后
标量子查询:返回结果 一列一行
select * from student where c_id = (select id from class where c_name = '六年级一班');
列子查询:返回结果 一列多行
select * from student where c_id in (select id from class);
select * from student where c_id =any (select id from class);
select * from student where c_id =some (select id from class);
select * from student where c_id =all (select id from class); -- 无结果
行子查询:返回结果 多列多行
构造行元素(age,height)
select * from student where (age,height) = (select max(age),max(height) from student);
-- from子句后
表子查询:返回结果当做二维表来使用
select * from (select * from student order by height desc) as a group by c_id;
-- exists子查询
select * from student exists(select * from class where id = 3);