SQL-like query language for csv

Logic Operators

operator description
AND Logical AND
OR Logical OR
NOT, ! Logical NOT

A logic operator returns a ternary value.

AND

condition AND condition
condition
value

If either of conditions is FALSE, then return FALSE. If both of conditions are not FALSE, and either of conditions is UNKNOWN, then return UNKNOWN. Otherwise return TRUE.

OR

condition OR condition
condition
value

If either of conditions is TRUE, then return TRUE. If both of conditions are not TRUE, and either of conditions is UNKNOWN, then return UNKNOWN. Otherwise return FALSE.

NOT

logical_not
  : NOT condition
  | !condition
condition
value

If the condition is TRUE, then return FALSE. If the condition is FALSE, then return TRUE. IF the condition is UNKNOWN, then return UNKNOWN.

NOT and ! return the same value, but there is the difference of precedence between these two operators.