oracle decode function explain
来源:互联网 发布:js监听ios软键盘事件 编辑:程序博客网 时间:2024/06/07 13:12
我们往往在做和并行的时候会用到oracle的decode()函数,他的使用格式为:
它的含义是,当expr的值和search值相同的时候就显示result,否则显示default值。详情可参考:oracle decode
举例说明:
我们这里有三张表,分别是:分数表、学生表、课程表。
分数表:
-- Create tablecreate table mzsf.TSCORE( fid NUMBER(5) not null, fstuid NUMBER(5), fclassid NUMBER(5), fscore NUMBER(3))tablespace MZSF pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );
学生表:
-- Create tablecreate table mzsf.TSTUDENT( fid NUMBER(5) not null, fname VARCHAR2(10), fage NUMBER(2))tablespace MZSF pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );
课程表:
-- Create tablecreate table mzsf.TCLASS( fid NUMBER(5) not null, fclassname VARCHAR2(10))tablespace MZSF pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );
我们根据他们之间的关联关系查询的结果为:
虽然我们查询出了张三和李四各科的成绩,但是看起来不显得那么明了,如果我们能够将李四的各科成绩都合并成一行来显示,那给人的感觉就一目了然,这里我们学到的decode函数将派上用场:
这样看起来就清晰很多了
0 0
- oracle decode function explain
- Oracle/PLSQL: Decode Function
- Oracle Function: Case and Decode
- oracle decode
- oracle decode
- Oracle DECODE
- oracle decode()
- oracle decode()
- ORACLE decode
- oracle decode
- Oracle DECODE
- oracle decode
- oracle decode
- Oracle Explain 2 --邵京国
- Oracle Explain Plan总结
- oracle EXPLAIN的使用
- Oracle Explain Plan
- Oracle Explain Plan
- java 随机获取国内IP
- sesq4
- plsql导出dmp或者导出对应的sql
- android手势滑动识别
- Linux之Makefile(.PHONY)
- oracle decode function explain
- Extjs多个tab页面——panel层叠
- 复习一下Android系统的启动过程
- ShellShock
- 手机app测试记录一
- ios简单自动化测试代码 UIAutoMonkey.js
- 处理器拦截器详解
- Jquey
- 多线程编程模型之工作组模式