NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Comparison Operators
editComparison Operators
editBoolean operator for comparing against one or multiple expressions.
Equality (=)
editSELECT last_name l FROM "test_emp" WHERE emp_no = 10000 LIMIT 5;
Null safe Equality (<=>)
editSELECT 'elastic' <=> null AS "equals"; equals --------------- false
SELECT null <=> null AS "equals"; equals --------------- true
Inequality (<> or !=)
editSELECT last_name l FROM "test_emp" WHERE emp_no <> 10000 ORDER BY emp_no LIMIT 5;
Comparison (<, <=, >, >=)
editSELECT last_name l FROM "test_emp" WHERE emp_no < 10003 ORDER BY emp_no LIMIT 5;
BETWEEN
editSELECT last_name l FROM "test_emp" WHERE emp_no BETWEEN 9990 AND 10003 ORDER BY emp_no;
IS NULL/IS NOT NULL
editSELECT last_name l FROM "test_emp" WHERE emp_no IS NOT NULL AND gender IS NULL;
IN (<value1>, <value2>, ...)
editSELECT last_name l FROM "test_emp" WHERE emp_no IN (10000, 10001, 10002, 999) ORDER BY emp_no LIMIT 5;