NOT,!

运算符说明

NOT,! 逻辑运算符用作于逻辑非运算。如果操作数为零,则返回结果为 true;如果操作数非零,则返回结果为 false;若果操作数为 NOT NUL 则返回 NULL

语法结构

  1. > SELECT not column_name FROM table_name;

示例

  1. mysql> select not 0;
  2. +-------+
  3. | not 0 |
  4. +-------+
  5. | true |
  6. +-------+
  7. 1 row in set (0.02 sec)
  8. mysql> select not null;
  9. +----------+
  10. | not null |
  11. +----------+
  12. | NULL |
  13. +----------+
  14. 1 row in set (0.00 sec)
  15. mysql> select not 1;
  16. +-------+
  17. | not 1 |
  18. +-------+
  19. | false |
  20. +-------+
  21. 1 row in set (0.01 sec)
  1. create table t1 (a boolean,b bool);
  2. insert into t1 values (0,1),(true,false),(true,1),(0,false),(NULL,NULL);
  3. mysql> select not a and not b from t1;
  4. +-----------------+
  5. | not a and not b |
  6. +-----------------+
  7. | false |
  8. | false |
  9. | false |
  10. | true |
  11. | NULL |
  12. +-----------------+
  13. 5 rows in set (0.00 sec)

限制

MatrixOne 暂时还不支持 ! 运算符。