Query 1 and Query 2 share the same semantics, both involving the combination of the NOT and BETWEEN operators, with the evaluation of the BETWEEN expression being FALSE in both cases. However, Query 1 unexpectedly retrieves more null values than Query 2. Could this be a logical error?
DROP TABLE tsqsdb0_t0;
CREATE TABLE tsqsdb0_t0(
time TIMESTAMP PRIMARY KEY,
c0 INTEGER
) USING TIMESERIES ;
INSERT OR REPLACE INTO tsqsdb0_t0(time, c0)
VALUES (TIMESTAMP('2022-01-01T16:00:00Z'), 0),
(TIMESTAMP('2022-01-01T16:00:05Z'), null);
Query 1
SELECT c0,
time
FROM tsqsdb0_t0
WHERE NOT ( 2 BETWEEN c0 AND 1);
Query 2
SELECT c0,
time
FROM tsqsdb0_t0
WHERE NOT ( -1 BETWEEN c0 AND 1);