1.and和or的优先级
and优先级大于or
root@ubuntu:~# cat windfunc
1001 100.0 ABC
1001 150.0 BCD
1001 200.0 CDE
1001 150.0 DEF
1002 200.0 ABC
1002 200.0 ABC
1002 100.0 BCD
1002 300.0 CDE
1002 50.0 DEF
1002 400.0 EFG
1003 100.0 ABC
1003 50.0 BCD
1004 60.0 ABC
hive> create table windfunc(id string,money float,type string) row format delimited fields terimnated by '\t' lines terminated by '\n' stored as textfile;
hive> load data local inpath '/root/windfunc' into table windfunc;
Copying data from file:/root/windfunc
Copying file: file:/root/windfunc
Loading data to table default.windfunc
[Warning] could not update stats.
OK
Time taken: 2.7 seconds
hive> select * from windfunc;
OK
1001 100.0 ABC
1001 150.0 BCD
1001 200.0 CDE
1001 150.0 DEF
1002 200.0 ABC
1002 200.0 ABC
1002 100.0 BCD
1002 300.0 CDE
1002 50.0 DEF
1002 400.0 EFG
1003 100.0 ABC
1003 50.0 BCD
1004 60.0 ABC
Time taken: 0.272 seconds, Fetched: 13 row(s)
hive> select * from windfunc where id = '1001' or id = '1002' and money = '100.0';
OK
1001 100.0 ABC
1001 150.0 BCD
1001 200.0 CDE
1001 150.0 DEF
1002