1. Null in MySQL cannot be used with any operator with other fields or variables (functions, stored procedures). There may be a problem if you use arithmetic data.
2. The judgment of NULL:
Create a user table: ID Key name can be empty
select * from user;
Insert into user values (' + ', null); # #创建一条name为空的数据
Insert into user values (' 222 ', '); # #创建一条为空字符的数据
Use ISNULL to determine if null: Only name is null when the return value of the ISNULL (exp) function is 1, the empty string and the data are 0;
The SQL statement filtered to NULL can also be used with the SELECT * from user, where name is not null;
or select * from user where ISNULL (name) = 0;
3. Simultaneous culling of null and empty strings
SELECT * from user where ISNULL (name) =0 and LENGTH (Trim (name)) >0;
4 determining whether null or an empty string in a function or stored procedure
SELECT Id,name,casewhen (ISNULL (name) =1) | | (LENGTH (Trim (NAME)) =0) Then ' AAA ' Endfromuser
MySQL judges null and empty string