Escolar Documentos
Profissional Documentos
Cultura Documentos
NULL Value
Conceptually, NULL means a missing unknown
value and it is treated somewhat differently from
other values
Arithmetic comparison operators such as =, <, or <>
cannot be used to test for NULL values
Conditions involving NULL are special and so we
cannot use = NULL or != NULL to look for NULL
values in columns
Such comparisons always fail because it's
impossible to tell whether or not they are true and
even NULL = NULL fails
Handling NULL Values
An SQL SELECT command along with WHERE clause is
used to fetch data from MySQL table, but when we try
to give a condition, which compare field or column
value to NULL, it does not work properly with an
equal to( = ) operator
To handle such situation MySQL provides three
operators
IS NULL: operator returns true if column value is NULL
IS NOT NULL: operator returns true if column value is
not NULL
<=>: operator compares values, which (unlike the =
operator) is true even for two NULL values
Using = and != for NULL Values
We will see that =
SELECT * FROM tcount_tbl
and != do not work
WHERE tutorial_count = NULL; with NULL values
SELECT * FROM tcount_tbl because it returns
WHERE tutorial_count != NULL;Empty Set
Tutoria Tutorial_title Tutorial_author Submission_d Tutorial_author Tutorial_cnt
l_id ate
ShivaniNanda 12
Sujay Chatterjee NULL
Srestha Anand 7
Kanchan Kumari NULL Annan Naidu 9
Akansha 7
MySQL ISNULL() function