select decode(columns, 'key', 'value' ) from table_name;
例如:
数据接口文档定义:
student 表 :
class : 1 -- 1班
2-- 2班
select decode(class, '1', 1班, '2', '2班') from student
class列不包含在1 2之内的,会被置为空
本文介绍 SQL 中 DECODE 函数的使用方法,并通过一个具体例子展示了如何将数字编码转换为对应的文本描述。该函数在处理枚举类型的数据时非常有用。
select decode(columns, 'key', 'value' ) from table_name;
例如:
数据接口文档定义:
student 表 :
class : 1 -- 1班
2-- 2班
select decode(class, '1', 1班, '2', '2班') from student
class列不包含在1 2之内的,会被置为空
774
5081

被折叠的 条评论
为什么被折叠?