Now let's set the birth field of one record in the test table to null.
mysql> Update test set t_birth=null where t_id=1;
Query OK, 1 row affected (0.02 sec)
Rows matched:1 changed:1 warnings:0
OK, execution is successful!
The syntax for setting a field value to NULL is: Set < field name >=null
To illustrate, there is no case-sensitive distinction, can be null, or it can be null.
Here's a look at the results:
Mysql> select * from test;
+------+--------+----------------------------------+------------+
| t_id | T_name | T_password | T_birth |
+------+--------+----------------------------------+------------+
| 1 | name1 | 12345678901234567890123456789012 | NULL |
| 2 | name2 | 12345678901234567890123456789012 | 2013-01-01 |
+------+--------+----------------------------------+------------+
2 rows in Set (0.00 sec)
Next, check out the records for which the field T_birth value is blank or not blank:
Mysql> SELECT * FROM test where t_birth is null;
+------+--------+----------------------------------+---------+
| t_id | T_name | T_password | T_birth |
+------+--------+----------------------------------+---------+
| 1 | name1 | 12345678901234567890123456789012 | NULL |
+------+--------+----------------------------------+---------+
1 row in Set (0.00 sec)
Mysql> SELECT * FROM test where t_birth are NOT null;
+------+--------+----------------------------------+------------+
| t_id | T_name | T_password | T_birth |
+------+--------+----------------------------------+------------+
| 2 | name2 | 12345678901234567890123456789012 | 2013-01-01 |
+------+--------+----------------------------------+------------+
1 row in Set (0.00 sec)
Description
1. Syntax for null query field value: where < field name > is null
2. Syntax for query field value NOT NULL: where < Field name > is NOT NULL
About MySQL query empty fields or Non-null fields (is null and NOT NULL), this article on the introduction of so many, I hope to help you, thank you!