gpt4 book ai didi

mysql - MySql not 运算符的令人惊讶的行为

转载 作者:行者123 更新时间:2023-11-28 23:26:59 25 4
gpt4 key购买 nike

我希望这个查询将所有列返回为 0,正确的表达式 1 是怎样的?

select (not(55))=1, !(55)=1, not(55)=1 ;

+-------------+---------+-----------+
| (not(55))=1 | !(55)=1 | not(55)=1 |
+-------------+---------+-----------+
| 0 | 0 | 1 |
+-------------+---------+-----------+

我发现 NOT 和 !不等价,而且括号很重要。

[编辑:简化原始帖子的查询]

最佳答案

在您的第一列中,代码类似于(mysql 对代码 (55)=0 执行隐式评估)

select  (55)=1 from dual;  /* result 0  false*/ 

然后

select  not (55)=1 from dual; /* resul  1 true alias not false */

关于mysql - MySql not 运算符的令人惊讶的行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38921970/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com