MySQL???IFNULL??NULLIF??ISNULL?÷?
???????????? ???????[ 2016/9/21 10:03:36 ] ????????????? MySQL
?????????MySql???isnull?????????MSSQL???????е???????????????£?
????mysql??isnull??ifnull??nullif???÷????£?
????isnull(expr) ???÷?????expr ?null?????isnull() ??????? 1?????????? 0??mysql> select isnull(1+1);-> 0mysql> select isnull(1/0);-> 1???= ??null ??????????????isnull() ????? is null?????????????Щ????????????μ??й?is null ???????
????IFNULL(expr1??expr2)???÷???
????????expr1 ???NULL???? IFNULL() ??????? expr1;?????????? expr2??IFNULL()??????????????????????????????????????????????
????mysql> SELECT IFNULL(1??0); -> 1mysql> SELECT IFNULL(NULL??10); -> 10mysql> SELECT IFNULL(1/0??10); -> 10mysql> SELECTIFNULL(1/0??'yes');
????-> 'yes'
????IFNULL(expr1??expr2)??????????????????и???“???”???????????STRING?? REAL??INTEGER????????????????????????? ??MySQL????????洢???д?????????????IFNULL()????????CREATE TABLE tmp SELECT IFNULL(1??'test') AS test????????????У??????е?????? CHAR(4)??NULLIF(expr1??expr2)???÷??????expr1= expr2 ???????????????NULL?????????? expr1?????CASE WHEN expr1 = expr2THENNULL ELSE expr1 END?????mysql> SELECTNULLIF(1??1);
????->NULLmysql> SELECT NULLIF(1??2); -> 1???????????????MySQL ?????????? expr1 ??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11