Oracle 5.0 Reference Manual page 918

Table of Contents

Advertisement

mysql>
+--------------+-----------------------+
| filename
+--------------+-----------------------+
| C:
| C:\
| C:\Programs
| C:\Programs\ |
+--------------+-----------------------+
expr NOT LIKE pat [ESCAPE 'escape_char']
This is the same as
NOT (expr LIKE pat [ESCAPE
Note
Aggregate queries involving
containing
following table and data:
CREATE TABLE foo (bar VARCHAR(10));
INSERT INTO foo VALUES (NULL), (NULL);
The query
returns 0. You might assume that
bar NOT LIKE '%baz%';
The second query returns 0. This is because
returns NULL, regardless of the value of expr. The same is true for aggregate
queries involving
REGEXP
[881]
OR
SELECT COUNT(*) FROM foo WHERE bar NOT LIKE '%baz%' OR bar IS NULL;
STRCMP(expr1,expr2)
[898]
returns
STRCMP()
second according to the current sort order, and
mysql>
SELECT STRCMP('text', 'text2');
-> -1
mysql>
SELECT STRCMP('text2', 'text');
-> 1
mysql>
SELECT STRCMP('text', 'text');
-> 0
[898]
performs the comparison using the collation of the arguments.
STRCMP()
mysql>
SET @s1 = _latin1 'x' COLLATE latin1_general_ci;
mysql>
SET @s2 = _latin1 'X' COLLATE latin1_general_ci;
mysql>
SET @s3 = _latin1 'x' COLLATE latin1_general_cs;
mysql>
SET @s4 = _latin1 'X' COLLATE latin1_general_cs;
mysql>
SELECT STRCMP(@s1, @s2), STRCMP(@s3, @s4);
+------------------+------------------+
| STRCMP(@s1, @s2) | STRCMP(@s3, @s4) |
+------------------+------------------+
|
0 |
+------------------+------------------+
If the collations are incompatible, one of the arguments must be converted to be compatible with the
other. See
Section 10.1.7.5, "Collation of
mysql>
SELECT STRCMP(@s1, @s3);
ERROR 1267 (HY000) at line 10: Illegal mix of collations (latin1_general_ci,IMPLICIT) and (latin1_general
mysql>
SELECT STRCMP(@s1, @s3 COLLATE latin1_general_ci);
String Comparison Functions
SELECT filename, filename LIKE '%\\\\' FROM t1;
| filename LIKE '%\\\\' |
|
|
|
NOT LIKE
may yield unexpected results. For example, consider the
NULL
SELECT COUNT(*) FROM foo WHERE bar LIKE '%baz%';
would return 2. However, this is not the case:
and comparisons using
NULL
[899]. In such cases, you must test explicitly for
(and not
[880]), as shown here:
AND
[898]
if the strings are the same,
0
otherwise.
1
1 |
Expressions".
898
0 |
1 |
0 |
1 |
[898]
'escape_char']).
[898]
comparisons with columns
SELECT COUNT(*) FROM foo WHERE
NULL NOT LIKE expr
NOT RLIKE
NOT NULL
if the first argument is smaller than the
-1
always
[899]
or
NOT
using

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents