Back to Questdb

Logical Operators

documentation/query/operators/logical.md

latest963 B
Original Source

OR Logical OR

OR represents a logical OR operation, which takes two predicates and filters for either one being true.

Examples

questdb-sql
SELECT * FROM (SELECT 5 AS a, 10 AS b) WHERE A = 5 OR B = 2
ab
510
questdb-sql
SELECT * FROM (SELECT 5 AS a, 10 AS b) WHERE A = 3 OR B = 2
ab

AND Logical AND

AND represents a logical AND operation, which takes two predicates and filters for both being true.

Examples

questdb-sql
SELECT * FROM (SELECT 5 AS a, 10 AS b) WHERE A = 5 AND B = 2
ab
questdb-sql
SELECT * FROM (SELECT 5 AS a, 10 AS b) WHERE A = 5 AND B = 10
ab
510

NOT Logical NOT

NOT inverts the boolean value. This can be combined with other operators to create their inverse operations, i.e NOT IN, NOT WITHIN.

Example

questdb-sql
SELECT NOT TRUE
column
false