mysql if 、ifnull、is not null 和isnull函数
来源:互联网 发布:剑灵灵族女捏脸数据 编辑:程序博客网 时间:2024/06/08 06:56
一、IF函数
表达式:IF(expr1,expr2,expr3)
满足条件expr1即条件expr1返回true
则expr2否则就是expr3 返回false
作为排序条件使用时 放在order by 后
eg:
1. SELECT IF(1=1,2,3); 则输出2
2.SELECT IF(1=2,2,3);则输出3
select * from test_table order by if(ISNULL(idcard),1,0)
二、IFNULL函数
表达式:IFNULL(expr1,expr2)
如果expr1值为NULL,则输出expr2
如果expr1值不为空则输出expr1本身
eg:
1.SELECT IFNULL(null,”2”);则输出2
2.SELECT IFNULL(3,”2”);则输出3
三、is not null函数
select * from test where name is not null;
四、isnull(expr) 的用法:
如expr 为null,那么isnull() 的返回值为 1,否则返回值为 0。
0 0
- mysql if 、ifnull、is not null 和isnull函数
- mysql 里面的isnull()和ifnull() is null 和 is not null
- mysql 里面的isnull()和ifnull() is null 和 is not null
- mysql 里面的isnull()和ifnull() is null 和 is not null
- mysql 里面的isnull()和ifnull() is null 和 is not null
- mysql 里面的isnull()、 is null 和 is not null、ifnull()
- MySQL 的IFNULL()、ISNULL()和NULLIF()函数
- MySql函数之 ISNULL()、NULLIF()和IFNULL()
- MYSQL函数ISNULL、IFNULL、NULLIF、IF、CASE WHEN
- mysql 中 isnull 和 ifnull 判断字段是否为null
- sql------isnull 和 ifnull 函数
- SQLServer的ISNULL函数和Mysql的IFNULL函数
- SQLServer的ISNULL函数和Mysql的IFNULL函数
- MySQL中的isnull、ifnull和nullif函数用法
- MySQL中的isnull、ifnull和nullif函数用法
- MySQL中的isnull、ifnull和nullif函数用法
- MYSQL IF 和 IFNULL
- MySQL的if,case语句使用总结..MySql 里的IFNULL、NULLIF和ISNULL用法
- java的垃圾回收机制例题讲解
- 线段覆盖 dp
- wlan常识
- MySQL查询缓存设置 提高MySQL查询性能
- android电池(五):电池 充电IC(PM2301)驱动分析篇
- mysql if 、ifnull、is not null 和isnull函数
- Java开发中的23种设计模式详解
- 关于这个博客建立的目的
- 剑指offer:旋转数组的最小数字
- MongoDB初识之数据库、集合、文档
- 数据库连接数和相关查询
- this指针
- 一个完整的Nodejs项目 完成连接数据库(MySQL),登陆、注册功能 session的使用 和发送邮件
- 执行rpm -Uvh xxxxxx.rpm, 报freely redistributed under the terms of the GNU GPL