MYSQ ifnull
时间: 2023-08-30 07:08:32 浏览: 109
浅谈Mysql中类似于nvl()函数的ifnull()函数
5星 · 资源好评率100%
IFNULL函数在MySQL中的作用是用于判断一个值是否为NULL,如果是NULL,则返回指定的替代值,否则返回原始值。当IFNULL函数的第一个参数为NULL时,它会返回第二个参数的值。例如,SELECT IFNULL(NULL, 0)会返回0,因为NULL被替换为0。IFNULL函数在使用上下文中可以根据需要返回字符串或数字,但如果要基于TRUE或FALSE条件返回值,应该使用IF函数而不是IFNULL函数。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [MySql中的IFNULL、NULLIF和ISNULL用法详解](https://download.csdn.net/download/weixin_38737283/13701068)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [mysql函数IFNULL使用的注意事项(必看!!)](https://blog.csdn.net/FU250/article/details/79989410)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [MySQL ifnull()函数](https://blog.csdn.net/wang121213145/article/details/125204990)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文