53.7. Control Flow Functions

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
云数据库 RDS MySQL Serverless,价值2615元额度,1个月
简介:

CASE

		
mysql> SELECT CASE 1 WHEN 1 THEN 'one'
    ->     WHEN 2 THEN 'two' ELSE 'more' END;
        -> 'one'
mysql> SELECT CASE WHEN 1>0 THEN 'true' ELSE 'false' END;
        -> 'true'
mysql> SELECT CASE BINARY 'B'
    ->     WHEN 'a' THEN 1 WHEN 'b' THEN 2 END;
        -> NULL		
		
		

IFNULL

		
mysql> SELECT IFNULL("TEST", 'OK');
+----------------------+
| IFNULL("TEST", 'OK') |
+----------------------+
| TEST                 |
+----------------------+
1 row in set (0.00 sec)

mysql> SELECT IFNULL(NULL, 'OK');
+--------------------+
| IFNULL(NULL, 'OK') |
+--------------------+
| OK                 |
+--------------------+
1 row in set (0.00 sec)		
		
		

NULLIF()

		

IF

		
mysql> SELECT IFNULL("TEST", 'OK');
+----------------------+
| IFNULL("TEST", 'OK') |
+----------------------+
| TEST                 |
+----------------------+
1 row in set (0.00 sec)

mysql> SELECT IFNULL(NULL, 'OK');
+--------------------+
| IFNULL(NULL, 'OK') |
+--------------------+
| OK                 |
+--------------------+
1 row in set (0.00 sec)		
		
		





原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
24天前
|
人工智能 机器人 测试技术
【CMake报错】报错:Flow control statements are not properly nested.
【CMake报错】报错:Flow control statements are not properly nested.
SAP WM LPK1 不能把 cross-material control cycles定义成release order parts
SAP WM LPK1 不能把 cross-material control cycles定义成release order parts
SAP WM LPK1 不能把 cross-material control cycles定义成release order parts
Multiple Origin composition test - Opportunity Creation case
Sent: Wednesday, 3 December, 2014 2:48 PM 结论是:如果gateway系统上针对一个odata service维护了多个mark成default的backend system,在creation的case下,runtime时候gateway只会向第一个 Default system发起请求。
111 0
Multiple Origin composition test - Opportunity Creation case
A small tip to explore how to call a method of a control
Created by Jerry Wang, last modified on Mar 20, 2015
112 0
A small tip to explore how to call a method of a control
header note truncation issue - designed behavior
header note truncation issue - designed behavior
85 0
header note truncation issue - designed behavior
SAP cross distribution chain status在Fiori应用中的draft handling
The explanation why draft handling is necessary in Fiori application could be found from Fiori Design Guideline. In this blog, I will use the update of field “cross distribution chain status” in S4 Product master Fiori application as example. This field could be found from Fiori UI:
135 0
SAP cross distribution chain status在Fiori应用中的draft handling
How is SAP CDS metadata retrieved from GM6 frontend - text related
How is SAP CDS metadata retrieved from GM6 frontend - text related
How is SAP CDS metadata retrieved from GM6 frontend - text related
how is RFC to backend determined - maintenance view IWFNDV_MGDEAM
005. how is RFC to backend determined - maintenance view /IWFND/V_MGDEAM Created by Wang, Jerry, last modified on Dec 26, 2014
how is RFC to backend determined - maintenance view IWFNDV_MGDEAM