首页 >

sql中的if判断语句应该怎么写 – 数据库 – 前端|

愚五笔怎么打,开发app怎么盈利,m8截图怎么截屏sql中的if判断语句应该怎么写 - 数据库 - 前端|sql中的if判断语句应该怎么写

语义上是按书写的从前到后顺序匹配的。参考sql 2006标准的Part 2: Foundation (SQL/Foundation)的6.11 <case expression>:

2) Case:a) If the value of the <search condition> of some <searched when clause> in a <case specification> is True, then the value of the <case specification> is the value of the <result> of the first (leftmost) <searched when clause> whose <search condition> evaluates to True, cast as the declared type of the <case specification>.b) If no <search condition> in a <case specification> evaluates to True, then the value of the <case expression> is the value of the <result> of the explicit or implicit <else clause>, cast as the declared type of the <case specification>.

当然优化器有可能可以尝试分析when的条件是否互斥,如果互斥而且无副作用的话可以任意调整顺序,不过表面上展现的语义仍然跟从前到后顺序匹配是一样的。所以从使用的角度看就只认顺序匹配就对了。


sql中的if判断语句应该怎么写 - 数据库 - 前端|
  • Wordpress是什么啊 - 数据库 - 前端|
  • Wordpress是什么啊 - 数据库 - 前端| | Wordpress是什么啊 - 数据库 - 前端| ...

    sql中的if判断语句应该怎么写 - 数据库 - 前端|
  • mysql如何去除空格 - 数据库 - 前端,metasploit不用mysql
  • mysql如何去除空格 - 数据库 - 前端,metasploit不用mysql | mysql如何去除空格 - 数据库 - 前端,metasploit不用mysql ...

    sql中的if判断语句应该怎么写 - 数据库 - 前端|
  • 环境影响评价工程师需要掌握的基本技能有哪些方面 - 数据库 - 前端|
  • 环境影响评价工程师需要掌握的基本技能有哪些方面 - 数据库 - 前端| | 环境影响评价工程师需要掌握的基本技能有哪些方面 - 数据库 - 前端| ...