表情况描述:
总条数:8万条,满足where条件的数据:8万条。
1.结果只有200条
select count(1)from test.tmp_test
where time ='2024-03-01 00:00:00' and a >=0 and b<= 100;
2.结果有8万条
select count(1)from test.tmp_test
where time ='2024-03-01 00:00:00' and a >=0 and b<= round(100);
3.结果有8万条
select count(1)from test.tmp_test
where time ='2024-03-01 00:00:00' and a >=0 and round(b,2)<= 100;
4.结果 rn1有8万条,rn2有8万条
select count(1),count(case when b<= 100 then 1 else null end) rn1,
count(case when round(b,2)<= 100 then 1 else null end) rn2
from test.tmp_test
where time ='2024-03-01 00:00:00' and a >=0 ;
问题:
- 参照查询1,2,3,是否所有的比较运算符之后的 都会隐式转换?如果是的话,是不是所有比较运算符后的都要加类型转换函数?
- 参照查询1和4,是不是只有where条件中的比较运算符会隐式转换?