Home > Database > Mysql Tutorial > Mysql coalesce()函数认识和用法_MySQL

Mysql coalesce()函数认识和用法_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:40:54
Original
1705 people have browsed it

bitsCN.com
Mysql coalesce()函数认识和用法 coalesce()解释:返回参数中的第一个非空表达式(从左向右);  鉴于在mysql中没有nvl()函数, 我们用coalesce()来代替。
 coalesce相比nvl优点是,coalesce中参数可以有多个,而nvl()中参数就只有两个。
 当然,在oracle中也可以使用 case when....then....else......end
 (比较强悍,case when 后可以跟表达式)。    使用示例:a,b,c三个变量。  Sql代码  select coalesce(a,b,c);   如果a==null,则选择b;如果b==null,则选择c;如果a!=null,则选择a;如果a b c 都为null ,则返回为null(没意义)。 bitsCN.com

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template