mysql ---- sql statement, function usage

In IFNULL mysql () method:

Generally when we use ifnull () method, it is similar to the following statement:

IFNULL (expr1, expr2)
if expr1 is not NULL, IFNULL () returns expr1, otherwise it returns expr2. The IFNULL () Returns a string or numeric value

select ifnull(name,'no name') from person;

The query to the results null into a specified string, but in fact can also be used in ifnull where the query portion ():

Intent: to find out the name field to null records

select * from person where ifnull(name,'no name')='no name';
————————————————

Guess you like

Origin www.cnblogs.com/xiaozengzeng/p/12159235.html