Add SQL queries with NOT comparison
Original commit: elastic/x-pack-elasticsearch@88c76be0a4
This commit is contained in:
parent
a040f3bb14
commit
928c750585
|
@ -2,27 +2,54 @@
|
||||||
// Filter
|
// Filter
|
||||||
//
|
//
|
||||||
|
|
||||||
whereFieldQuality
|
whereFieldEquality
|
||||||
SELECT last_name l FROM "test_emp" WHERE emp_no = 10000 LIMIT 5;
|
SELECT last_name l FROM "test_emp" WHERE emp_no = 10000 LIMIT 5;
|
||||||
|
whereFieldNonEquality
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE emp_no <> 10000 ORDER BY emp_no LIMIT 5;
|
||||||
|
whereFieldNonEqualityJavaSyntax
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE emp_no != 10000 ORDER BY emp_no LIMIT 5;
|
||||||
whereFieldLessThan
|
whereFieldLessThan
|
||||||
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 ORDER BY emp_no LIMIT 5;
|
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 ORDER BY emp_no LIMIT 5;
|
||||||
whereFieldAndComparison
|
whereFieldAndComparison
|
||||||
SELECT last_name l FROM "test_emp" WHERE emp_no > 10000 AND emp_no < 10005 ORDER BY emp_no LIMIT 5;
|
SELECT last_name l FROM "test_emp" WHERE emp_no > 10000 AND emp_no < 10005 ORDER BY emp_no LIMIT 5;
|
||||||
whereFieldOrComparison
|
whereFieldOrComparison
|
||||||
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 OR emp_no = 10005 ORDER BY emp_no LIMIT 5;
|
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 OR emp_no = 10005 ORDER BY emp_no LIMIT 5;
|
||||||
|
|
||||||
|
whereFieldEqualityNot
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE NOT emp_no = 10000 LIMIT 5;
|
||||||
|
whereFieldNonEqualityNot
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE NOT emp_no <> 10000 ORDER BY emp_no LIMIT 5;
|
||||||
|
whereFieldNonEqualityJavaSyntaxNot
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE NOT emp_no != 10000 ORDER BY emp_no LIMIT 5;
|
||||||
|
whereFieldLessThanNot
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE NOT emp_no < 10003 ORDER BY emp_no LIMIT 5;
|
||||||
|
whereFieldAndComparisonNot
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE NOT (emp_no > 10000 AND emp_no < 10005) ORDER BY emp_no LIMIT 5;
|
||||||
|
whereFieldOrComparisonNot
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE NOT (emp_no < 10003 OR emp_no = 10005) ORDER BY emp_no LIMIT 5;
|
||||||
|
|
||||||
whereFieldWithOrder
|
whereFieldWithOrder
|
||||||
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 ORDER BY emp_no;
|
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 ORDER BY emp_no;
|
||||||
whereFieldWithExactMatchOnString
|
whereFieldWithExactMatchOnString
|
||||||
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 AND gender = 'M';
|
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 AND gender = 'M';
|
||||||
|
whereFieldWithNotEqualsOnString
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 AND gender <> 'M';
|
||||||
whereFieldWithLikeMatch
|
whereFieldWithLikeMatch
|
||||||
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 AND last_name LIKE 'K%';
|
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 AND last_name LIKE 'K%';
|
||||||
whereFieldWithNegatedLikeMatch
|
|
||||||
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 AND last_name NOT LIKE 'K%';
|
whereFieldWithOrderNot
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE NOT emp_no < 10003 ORDER BY emp_no LIMIT 5;
|
||||||
|
whereFieldWithExactMatchOnStringNot
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE NOT (emp_no < 10003 AND gender = 'M') ORDER BY emp_no LIMIT 5;
|
||||||
|
whereFieldWithNotEqualsOnStringNot
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE NOT (emp_no < 10003 AND gender <> 'M') ORDER BY emp_no LIMIT 5;
|
||||||
|
whereFieldWithLikeMatchNot
|
||||||
|
SELECT last_name l FROM "test_emp" WHERE NOT (emp_no < 10003 AND last_name NOT LIKE 'K%') ORDER BY emp_no LIMIT 5;
|
||||||
|
|
||||||
whereFieldOnMatchWithAndAndOr
|
whereFieldOnMatchWithAndAndOr
|
||||||
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 AND (gender = 'M' AND NOT FALSE OR last_name LIKE 'K%') ORDER BY emp_no;
|
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 AND (gender = 'M' AND NOT FALSE OR last_name LIKE 'K%') ORDER BY emp_no;
|
||||||
|
|
||||||
// TODO: (NOT) RLIKE, <>, <=>, !=
|
// TODO: (NOT) RLIKE in particular and more NOT queries in general
|
||||||
|
|
||||||
whereIsNotNullAndComparison
|
whereIsNotNullAndComparison
|
||||||
SELECT last_name l FROM "test_emp" WHERE emp_no IS NOT NULL AND emp_no < 10005 ORDER BY emp_no;
|
SELECT last_name l FROM "test_emp" WHERE emp_no IS NOT NULL AND emp_no < 10005 ORDER BY emp_no;
|
||||||
|
|
Loading…
Reference in New Issue