Oracle 5.0 Reference Manual page 898

Table of Contents

Advertisement

For best results when using
explicitly convert the values to the desired data type. Examples: If you compare a
values, convert the
DATE
in a comparison to a DATE, cast the string to a DATE.
'2001-1-1'
expr NOT BETWEEN min AND max
This is the same as
NOT (expr BETWEEN min AND
COALESCE(value,...)
Returns the first
non-NULL
mysql>
SELECT COALESCE(NULL,1);
-> 1
mysql>
SELECT COALESCE(NULL,NULL,NULL);
-> NULL
GREATEST(value1,value2,...)
With two or more arguments, returns the largest (maximum-valued) argument. The arguments are
compared using the same rules as for
mysql>
SELECT GREATEST(2,0);
-> 2
mysql>
SELECT GREATEST(34.0,3.0,5.0,767.0);
-> 767.0
mysql>
SELECT GREATEST('B','A','C');
-> 'C'
Before MySQL 5.0.13,
5.0.13, it returns
NULL
expr IN (value,...)
Returns
if
is equal to any of the values in the
1
expr
constants, they are evaluated according to the type of
is done using a binary search. This means
constants. Otherwise, type conversion takes place according to the rules described in
"Type Conversion in Expression
mysql>
SELECT 2 IN (0,3,5,7);
-> 0
mysql>
SELECT 'wefwf' IN ('wee','wefwf','weg');
-> 1
You should never mix quoted and unquoted values in an
quoted values (such as strings) and unquoted values (such as numbers) differ. Mixing types may
therefore lead to inconsistent results. For example, do not write an
SELECT val1 FROM tbl1 WHERE val1 IN (1,2,'a');
Instead, write it like this:
SELECT val1 FROM tbl1 WHERE val1 IN ('1','2','a');
The number of values in the
To comply with the SQL standard,
NULL, but also if no match is found in the list and one of the expressions in the list is NULL.
syntax can also be used to write certain types of subqueries. See
IN()
"Subqueries with ANY, IN, or
Comparison Functions and Operators
[877]
with date or time values, use
BETWEEN
values to
DATE
DATETIME
[878]
[878]
value in the list, or
[878]
LEAST()
[878]
returns
GREATEST()
if any argument is NULL.
[878]
IN
Evaluation", but applied to all the arguments.
list is only limited by the
IN
returns
IN
SOME".
878
values. If you use a string constant such as
max).
if there are no
non-NULL
NULL
[879].
only if all arguments are NULL. As of
NULL
list, else returns 0. If all values are
IN
and sorted. The search for the item then
expr
is very quick if the
IN
list because the comparison rules for
IN
IN
max_allowed_packet
not only if the expression on the left hand side is
NULL
[948]
to
CAST()
DATETIME
values.
value list consists entirely of
Section 12.2,
expression like this:
[466]
value.
Section 13.2.9.3,
to two

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents