where 条件里不支持不等式子查询,实际上是支持 in、not in、exists、not exists
select * from students where clazz in(select clazz from students as t where t.id=‘1
500100970’); //注意2张表是相同的,需要加标识,就是给表命名,区分
字段含有null值,使用nvl函数
eg:select id,nvl(x,0) from vels; //x为null就是0
(1)where :过滤数据、!!!分区裁剪!!!
(2)distinct
:去重
(3) join:left join、right join、join 注意MapJoin
map Join过程:大表进行切分block,在不同机器上,join小表时,join在每个机器上都应该有相同的数据,所有小表不进行mr,只是一个复制,所以复制的表小一些效率高
(4)group by : 通常结合聚合函数一起使用
(5)order by:对查询结果集执行一个全局排序,这也就是说所有的数据都通过一个reduce进行处理的过程,对于大数据集,这个过程将消耗很大的时间来执行
(6)sort by:局部排序,当有多个reduce时,只能保证单个reduce输出有序,不能保证全局有序
在使用sort by之前,需要先设置Reduce的数量>1,才会做局部排序,如果Reduce数量是1,作用与order by一样,全局排序。
(7)distribute by:分区,就是分区,让可能相同的hashcode的数据进入一个reduce
(8)cluster by = distribute by + sort by
image-20210114163608574.png
https://zhuanlan.zhihu.com/p/93747613 order by、distribute by、sort by、cluster by详解



