oracle行转列
select i.sid,i.sname,i.birthday,i.schooltime,i.sphone,c.classname,a.assnname,sum(decode(subject,'语文',s.score,0)) as chin,
sum(decode(subject,'数学',s.score,0)) as math,
sum(decode(subject,'英语',s.score,0)) as eng from student_info i
left join student_expand e on i.sid = e.sid left join student_class c on
c.classid = e.classid left join student_assn a on a.assnid = e.assnid left join student_score s on s.sid = i.sid
group by i.sid,i.sname,i.birthday,i.schooltime,i.sphone,c.classname,a.assnname;
行转列:
decode(subject,'数学',s.score,0) 用法:如果subject会等于数学 ,则最后值等于 s.score 否则值等于: 0
相关文档:
1. 创建普通用户
>create user username identified by username;
>grant create tablespace, resource ,connect to username;
2. 创建表空间和用户
2.1 创建临时表空间
>create temporary tablespace DB_TEMP
tempfile '/opt/oracle/oradata/mydb/t ......
Exam Number/Code : 1Z0-053
Exam Name : Oracle Database 11g: Administration II
Questions and Answers : 167 Q&As
Update Time: 2010-05-15
1. You are not sure if Flashback Database is enabled. What database column and view can you query to
see if the flashback logs are being created in the ......
60.AVG(DISTINCT|ALL)
all表示对所有的值求平均值,distinct只对不同的值求平均值
SQLWKS> create table table3(xm varchar(8),sal number(7,2));
语句已处理。
SQLWKS> insert into table3 values(gao,1111.11);
SQLWKS> insert into table3 values(gao,1111.11);
SQLWKS> insert into table3 values(zhu ......
Oracle的trunc 函数一般用来 对日期和时间进行截取。
1、数字处理 。截取
select trunc(5.75),trunc(5.75,1),trunc(5.75,-1),trunc(556.234,-2) from dual;
输出:
TRUNC(5.75) TRUNC(5.75,1) TRUNC(5.75,-1) TRUNC(556.234,-2)
----------- ------------- -------------- ----- ......
首先以sysdba身份登录
sqlplus connect system/orcl as sysdba;
然后修改参数
1.sga_target不能大于sga_max_size,可以设置为相等。
2.SGA加上PGA等其他进程占用的内存总数必须小于操作系统的物理内存。
alter system set sga_target=150M scope=spfile;
alter system set sga_max_size=150M scope=spfile;
//数据库 ......