NOT,!

Description

Logical NOT,!. Evaluates to true if the operand is 0, to false if the operand is nonzero, and NOT NULL returns NULL.

Syntax

  1. > SELECT not column_name FROM table_name;

Examples

  1. > select not 0;
  2. +-------+
  3. | not 0 |
  4. +-------+
  5. | true |
  6. +-------+
  7. 1 row in set (0.02 sec)
  8. > select not null;
  9. +----------+
  10. | not null |
  11. +----------+
  12. | NULL |
  13. +----------+
  14. 1 row in set (0.00 sec)
  15. > 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. > select * from t1;
  4. > select not a and not b from t1;
  5. +-----------------+
  6. | not a and not b |
  7. +-----------------+
  8. | false |
  9. | false |
  10. | false |
  11. | true |
  12. | NULL |
  13. +-----------------+
  14. 5 rows in set (0.00 sec)

Constraints

! is not supported for now.