比較演算子
1つまたは複数の式に対して比較するためのブール演算子です。
等号 (=)
Sql
SELECT last_name l FROM "test_emp" WHERE emp_no = 10000 LIMIT 5;
ヌル安全等号 (<=>)
Sql
SELECT 'elastic' <=> null AS "equals";
equals
---------------
false
Sql
SELECT null <=> null AS "equals";
equals
---------------
true
不等号 (<>) または (!=)
Sql
SELECT last_name l FROM "test_emp" WHERE emp_no <> 10000 ORDER BY emp_no LIMIT 5;
比較 (<, <=, >, >=)
Sql
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 ORDER BY emp_no LIMIT 5;
BETWEEN
Sql
SELECT last_name l FROM "test_emp" WHERE emp_no BETWEEN 9990 AND 10003 ORDER BY emp_no;
IS NULL/IS NOT NULL
Sql
SELECT last_name l FROM "test_emp" WHERE emp_no IS NOT NULL AND gender IS NULL;
IN (, , …)
Sql
SELECT last_name l FROM "test_emp" WHERE emp_no IN (10000, 10001, 10002, 999) ORDER BY emp_no LIMIT 5;