WHERE
=
SELECT myinteger
FROM mytable
WHERE myvarchar = 'MIKE';
SELECT myinteger
FROM mytable
WHERE myvarchar = N'MIKE';
SELECT *
FROM mytable
WHERE UPPER(mycolumn) = UPPER('mystring');
Also see "case-insensitive comparison" section later on this page.
IS NULL
SELECT myinteger
FROM mytable
WHERE myvarchar IS NULL;
SELECT myinteger
FROM mytable
WHERE myvarchar IS NOT NULL;
BETWEEN
SELECT myinteger
FROM mytable
WHERE myinteger BETWEEN 111 AND 999;
IN
EXISTS
LIKE
SELECT myinteger
FROM mytable
WHERE myvarchar LIKE 'MI%';
REGEXP_LIKE
By default, acts in a similar war to 'LIKE'...
SELECT *
FROM mytable
WHERE REGEXP_LIKE(mycolumn, 'mystring');
To make the comparison case-insensitive...
SELECT *
FROM mytable
WHERE REGEXP_LIKE(mycolumn, 'mystring', 'i');
To make REGEXP_LIKE act like '='...
SELECT *
FROM mytable
WHERE REGEXP_LIKE(mycolumn, '^mystring$');
AND
SELECT myinteger
FROM mytable
WHERE myinteger = 111
AND myvarchar = 'MIKE';
OR
SELECT myinteger
FROM mytable
WHERE myinteger = 111
OR myvarchar = 'MIKE';
Case-Insensitive Comparison
Session Level
ALTER SESSION SET NLS_SORT=BINARY_CI;
ALTER SESSION SET NLS_COMP=LINGUISTIC;
Index Level
CREATE INDEX myindex
ON mytable
(NLSSORT(mycolumn,'NLS_SORT=BINARY_CI'));
Query Level
SELECT *
FROM mytable
WHERE REGEXP_LIKE(mycolumn, 'mystring', 'i');
SELECT *
FROM mytable
WHERE mycolumn COLLATE BINRY_CI = 'mystring';
Videos
Bibliography
BETWEENhttps://www.techonthenet.com/mysql/between.php
REGEXP_LIKEhttps://stackoverflow.com/questions/5391069/case-insensitive-searching-in-oraclehttp://www.sqlfiddle.com/#!4/0959f/4https://stackoverflow.com/questions/12613514/what-is-the-n-before-a-string-argument
Case-Insensitive Comparisonhttps://stackoverflow.com/questions/5391069/case-insensitive-searching-in-oracle