Oracle 5.0 Reference Manual page 2989

Table of Contents

Advertisement

mysql>
INSERT INTO my_table (phone) VALUES (NULL);
mysql>
INSERT INTO my_table (phone) VALUES ('');
Both statements insert a value into the
second inserts an empty string. The meaning of the first can be regarded as "phone number is not
known" and the meaning of the second can be regarded as "the person is known to have no phone,
and thus no phone number."
To help with
the
IFNULL()
In SQL, the
contains
NULL
operators and functions involved in the expression. All columns in the following example return NULL:
mysql>
SELECT NULL, 1+NULL, CONCAT('Invisible',NULL);
To search for column values that are NULL, you cannot use an
statement returns no rows, because
mysql>
SELECT * FROM my_table WHERE phone = NULL;
To look for
NULL
find the
NULL
mysql>
SELECT * FROM my_table WHERE phone IS NULL;
mysql>
SELECT * FROM my_table WHERE phone = '';
See
Section 3.3.4.6, "Working with
You can add an index on a column that can have
or BDB, or
MEMORY
you cannot insert
When reading data with
a
value into a column, use
NULL
some circumstances. See
When using DISTINCT,
When using
descending order.
Aggregate (summary) functions such as
values. The exception to this is
For example, the following statement produces two counts. The first is a count of the number of rows in
the table, and the second is a count of the number of
mysql>
SELECT COUNT(*), COUNT(age) FROM person;
For some data types, MySQL handles
column, the current date and time is inserted. If you insert
that has the
C.5.5.4. Problems with Column Aliases
An alias can be used in a query select list to give a column a different name. You can use the alias in
GROUP
BY,
SELECT SQRT(a*b) AS root FROM
GROUP BY root HAVING root > 0;
SELECT id, COUNT(*) AS cnt FROM
GROUP BY id HAVING cnt > 0;
SELECT id AS 'Customer identity' FROM tbl_name;
handling, you can use the
NULL
[884]
function.
value is never true in comparison to any other value, even NULL. An expression that
NULL
always produces a
NULL
values, you must use the
phone number and the empty phone number:
storage engine. Otherwise, you must declare an indexed column
into the column.
NULL
LOAD DATA
\N
Section 13.2.6,
BY, or
GROUP
values are presented first, or last if you specify
ORDER
BY,
NULL
COUNT(*)
attribute, the next number in the sequence is inserted.
AUTO_INCREMENT
BY, or
ORDER
HAVING
tbl_name
tbl_name
Query-Related Issues
column, but the first inserts a
phone
[877]
IS NULL
value unless otherwise indicated in the documentation for the
is never true for any expression:
expr = NULL
[877]
IS NULL
Values", for additional information and examples.
NULL
values if you are using the MyISAM, InnoDB,
NULL
INFILE, empty or missing columns are updated with ''. To load
in the data file. The literal word "NULL" may also be used under
"LOAD DATA INFILE
BY, all
ORDER
NULL
[970],
COUNT()
MIN()
[970], which counts rows and not individual column values.
non-NULL
values specially. If you insert
NULL
clauses to refer to the column:
2969
NULL
and
[877]
IS NOT NULL
test. The following
expr = NULL
test. The following statements show how to
Syntax".
values are regarded as equal.
DESC
[971], and
SUM()
values in the
age
into a
NULL
into an integer or floating-point column
NULL
value and the
operators and
NULL, and
NOT
to sort in
[972]
ignore
NULL
column:
TIMESTAMP

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents