易忘SQL整理

1.decode函数

DECODE函数是ORACLE PL/SQL的功能强大的函数

decode(value, if1, then1, if2,then2, if3,then3, . . . else )

Value 代表某个表的任何类型的任意列或一个通过计算所得的任何结果。当每个value值被测试,如果value的值为if1,Decode 函数的结果是then1;如果value等于if2,Decode函数结果是then2;等等。事实上,可以给出多个if/then 配对。如果value结果不等于给出的任何配对时,Decode 结果就返回else 。

需要注意的是,这里的if、then及else 都可以是函数或计算表达式。

2.查看表结构的详细信息

1、desc table_name 语句 (通用)

(Mysql中也可以使用:show create table 语句)

猜你喜欢

转载自blog.csdn.net/LMAKE_nbsp/article/details/84993249