SQL中 nvl()coalesce()decode()这三个函数是不是递进包含关系?
来源:学生作业帮 编辑:神马作文网作业帮 分类:英语作业 时间:2024/09/20 08:13:30
SQL中 nvl()coalesce()decode()这三个函数是不是递进包含关系?
比如:
select name,bonus from table where name='apple';
name bonus
----------------
apple 空 (我想让结果=0)
以下语句都对吗?如果有问题请指出,
1.select name,nvl(bonus,0) from table where name='apple';
2.select name,coalesce(bonus,0,1) from table where name='apple';
3.select name,coalesce(bonus,null,0) from table where name='apple';
4.select name,bonus,decode(name,‘apple’,0) from table where name='apple';
比如:
select name,bonus from table where name='apple';
name bonus
----------------
apple 空 (我想让结果=0)
以下语句都对吗?如果有问题请指出,
1.select name,nvl(bonus,0) from table where name='apple';
2.select name,coalesce(bonus,0,1) from table where name='apple';
3.select name,coalesce(bonus,null,0) from table where name='apple';
4.select name,bonus,decode(name,‘apple’,0) from table where name='apple';
nvl(bonus,0) 意思是 如果 bonus is null ,那么返回 0,否则返回 bonus
coalesce(bonus,0,1) 意思是 返回 参数列表中,第一个非 空的数据.
也就是相当于,如果 bonus is null ,那么返回 0,否则返回 bonus.
这里的最后一个参数 1,目测是打酱油的.
coalesce(bonus,null,0) 意思是 返回 参数列表中,第一个非 空的数据.
也就是相当于,如果 bonus is null ,那么第2个参数还是 null,最后返回第3个参数 0
decode(name,‘apple’,0) 意思是,如果 name = 'apple' 那么返回 0
否则的话 ,就是返回 null 了.
再问: 那我的这三条语句都对吗?
再答: 函数的使用上面, 没有问题。 就是 from table 不对。 因为 table 是关键字。 当然了,如果你这里的 table 只是举例的话, 那么就都没有问题。
coalesce(bonus,0,1) 意思是 返回 参数列表中,第一个非 空的数据.
也就是相当于,如果 bonus is null ,那么返回 0,否则返回 bonus.
这里的最后一个参数 1,目测是打酱油的.
coalesce(bonus,null,0) 意思是 返回 参数列表中,第一个非 空的数据.
也就是相当于,如果 bonus is null ,那么第2个参数还是 null,最后返回第3个参数 0
decode(name,‘apple’,0) 意思是,如果 name = 'apple' 那么返回 0
否则的话 ,就是返回 null 了.
再问: 那我的这三条语句都对吗?
再答: 函数的使用上面, 没有问题。 就是 from table 不对。 因为 table 是关键字。 当然了,如果你这里的 table 只是举例的话, 那么就都没有问题。
SQL中 nvl()coalesce()decode()这三个函数是不是递进包含关系?
decode函数中嵌套了nvl函数,请问怎么用的,比如decode(nvl(a,0),1,2,3),谁给解释下,别跟我说
PLSQL Developer 中decode()函数的基本用法?
sql语句中decode函数怎么加条件
decode(A.type,0,1,0) 这个sql函数,
关于递进关系的排比句急急急(递进要一层比一层深奥的 )
decode函数
oracle中decode函数的应用问题.
两个关联词能用在一起吗 (比如一个递进关系,一个假设关系)
《岳阳楼记》一下前两段文字的关系是( )A.承接关系 B.并列关系 C.递进关系 D.因果关系
Oracle中如何的decode函数的使用
decode()函数怎么用?