问答 / 0 / 5 / 创建于 2年前
虽然是不正常sql语句,但是为何第一条语句有返回内容,而第二条却没有内容返回。
请指点~
select count(*) ct from cs.a where true; -- 全表 select count(*) ct from cs.a where 123; -- 全表 select count(*) ct from cs.a where false; -- 空 select CAST('asd' as SIGNED) ; -- 0 select CAST(123 as SIGNED) ; -- 123
能不能看出点规律来
@Scrooge 是不是你说的这个不清楚,不过你可以 把 where 理解成 if 判断,比如
select * from t where a = 1 and (b < 0 or b = 3); -- 等价: if ($a ==1 ($b< 0 || $b == 3)) -- mysql 也有 exists ,判断是否存在
具体的不同类型的转换,不同语言不太一样,需要自己去尝试,这里建议用准确的类型比较
'a' == 0; // true, 7.x 'a' == 0; // false, 8.x
我要举报该,理由是:
推荐文章: