1、表:table1(FId,Fclass,Fscore),用最高效最简单的SQL列出各班成绩最高的列表,显示班级,成绩两个字段。2、有一个表table1有两个字段FID,Fno,字都非空,写一个SQL语句列出该表中一个FID对应多个不同的Fno的纪录。
类如:
101 a1001
101 a1001
102 a1002
102 a1003
103 a1004
104 a1005
104 a1006
105 a1007
105 a1007
105 a1007
结果:
102 a1002
102 a1003
104 a1005
104 a10063、有员工表empinfo
(
Fempno varchar2(10) not null pk,
Fempname varchar2(20) not null,
Fage number not null,
Fsalary number not null
);
假如数据量很大约1000万条;写一个你认为最高效的SQL,用一个SQL计算以下四种人:
fsalary>9999 and fage > 35
fsalary>9999 and fage < 35
fsalary<9999 and fage > 35
fsalary<9999 and fage < 35
每种员工的数量;4、表A字段如下
month person income
月份 人员 收入
要求用一个SQL语句(注意是一个)的处所有人(不区分人员)每个月及上月和下月的总收入
要求列表输出为
月份 当月收入 上月收入 下月收入
5,表B
C1 c2
2005-01-01 1
2005-01-01 3
2005-01-02 5要求的处数据
2005-01-01 4
2005-01-02 5
合计 9
试用一个Sql语句完成。
6,数据库1,2,3 范式的概念与理解。7,简述oracle行触发器的变化表限制表的概念和使用限制,行触发器里面对这两个表有什么限制。8、oracle临时表有几种。
临时表和普通表的主要区别有哪些,使用临时表的主要原因是什么?9,怎么实现:使一个会话里面执行的多个过程函数或触发器里面都可以访问的全局变量的效果,并且要实现会话间隔离?10,aa,bb表都有20个字段,且记录数量都很大,aa,bb表的X字段(非空)上有索引,
请用SQL列出aa表里面存在的X在bb表不存在的X的值,请写出认为最快的语句,并解译原因。11,简述SGA主要组成结构和用途?12什么是分区表?简述范围分区和列表分区的区别,分区表的主要优势有哪些?13,背景:某数据运行在archivelog,且用rman作过全备份和数据库的冷备份,
且所有的归档日志都有,现控制文件全部损坏,其他文件全部完好,请问该怎么恢复该数据库,说一两种方法。14,用rman写一个备份语句:备份表空间TSB,level 为2的增量备份。15,有个表a(x number(20),y number(20))用最快速高效的SQL向该表插入从1开始的连续的1000万记录。
类如:
101 a1001
101 a1001
102 a1002
102 a1003
103 a1004
104 a1005
104 a1006
105 a1007
105 a1007
105 a1007
结果:
102 a1002
102 a1003
104 a1005
104 a10063、有员工表empinfo
(
Fempno varchar2(10) not null pk,
Fempname varchar2(20) not null,
Fage number not null,
Fsalary number not null
);
假如数据量很大约1000万条;写一个你认为最高效的SQL,用一个SQL计算以下四种人:
fsalary>9999 and fage > 35
fsalary>9999 and fage < 35
fsalary<9999 and fage > 35
fsalary<9999 and fage < 35
每种员工的数量;4、表A字段如下
month person income
月份 人员 收入
要求用一个SQL语句(注意是一个)的处所有人(不区分人员)每个月及上月和下月的总收入
要求列表输出为
月份 当月收入 上月收入 下月收入
5,表B
C1 c2
2005-01-01 1
2005-01-01 3
2005-01-02 5要求的处数据
2005-01-01 4
2005-01-02 5
合计 9
试用一个Sql语句完成。
6,数据库1,2,3 范式的概念与理解。7,简述oracle行触发器的变化表限制表的概念和使用限制,行触发器里面对这两个表有什么限制。8、oracle临时表有几种。
临时表和普通表的主要区别有哪些,使用临时表的主要原因是什么?9,怎么实现:使一个会话里面执行的多个过程函数或触发器里面都可以访问的全局变量的效果,并且要实现会话间隔离?10,aa,bb表都有20个字段,且记录数量都很大,aa,bb表的X字段(非空)上有索引,
请用SQL列出aa表里面存在的X在bb表不存在的X的值,请写出认为最快的语句,并解译原因。11,简述SGA主要组成结构和用途?12什么是分区表?简述范围分区和列表分区的区别,分区表的主要优势有哪些?13,背景:某数据运行在archivelog,且用rman作过全备份和数据库的冷备份,
且所有的归档日志都有,现控制文件全部损坏,其他文件全部完好,请问该怎么恢复该数据库,说一两种方法。14,用rman写一个备份语句:备份表空间TSB,level 为2的增量备份。15,有个表a(x number(20),y number(20))用最快速高效的SQL向该表插入从1开始的连续的1000万记录。
解决方案 »
- 请问有没有办法对指定用户设置Oracle的默认并行度(DOP,Degree of Parallel)?
- 数据库回滚
- Oracle 2个登录用户 一个复制到另一个表中,复制其中的数据
- 请问为何nvl(a.cqualitylevelid,'a') = 'a' 行而 nvl(a.cqualitylevelid,'') = ''不行?
- 求一sql语句
- oracle中,如果一张表没有主键,怎么删除当前行?
- 请教:怎样删除组合主键
- 求教:还是关于oracle的会话
- Oracle->Sql Server问题(高手帮忙)
- 视图生成成功,但是查看视图的数据时报错:无法在没有键值保存表的连接视图中选择rowid
- java下的程序,请高人指点,能否用触发器来实现? 100分哟!!!!
- 如何动态调用带有游标返回的过程?
1、max group by
2、count(no) group by id having count(no) > 1
3、很高效的没想出来
4、可以用自连接
5、sum() group by rollup()
6 7 8 9不解释了
10、用左连接应该是最快的。
11 12 13 14不说了
15 同样,高效的没思路,循环我到是会。
FROM TABLE1 A
WHERE EXISTS(SELECT * FROM TABLE1 WHERE FID=A.FID AND FNO<>A.FNO)
3、SELECT FEMPNO,
SUM(CASE WHEN fsalary>9999 and fage > 35 THEN 1 ELSE 0),
SUM(CASE WHEN fsalary>9999 and fage < 35 THEN 1 ELSE 0),
SUM(CASE WHEN fsalary<9999 and fage > 35 THEN 1 ELSE 0),
SUM(CASE WHEN fsalary<9999 and fage < 35 THEN 1 ELSE 0)
FROM EMPINFO GROUP BY FEMPNO
select t.fclass,max(t.fscore) from table1 t
group by t.fclass
2、有一个表table1有两个字段FID,Fno,字都非空,写一个SQL语句列出该表中一个FID对应多个不同的Fno的纪录。
类如:
101a1001
101a1001
102a1002
102a1003
103a1004
104a1005
104a1006
105a1007
105a1007
105a1007
结果:
102a1002
102a1003
104a1005
104a1006select * from table1 t1,table1 t2
where t1.fid=t2.fid t1.fno<>t2.fno3、有员工表empinfo
(
Fempno varchar2(10) not null pk,
Fempname varchar2(20) not null,
Fage number not null,
Fsalary number not null
);
假如数据量很大约1000万条;写一个你认为最高效的SQL,用一个SQL计算以下四种人:
fsalary>9999 and fage > 35
fsalary>9999 and fage < 35
fsalary<9999 and fage > 35
fsalary<9999 and fage < 35
每种员工的数量;select *
from (select 'fsalary>9999 and fage > 35', count(1)
from empinfo t
where t.fsalary > 9999 and fage > 35
union
select 'fsalary>9999 and fage < 35', count(1)
from empinfo t
where t.fsalary > 9999 and fage < 35
union
select 'fsalary<9999 and fage > 35', count(1)
from empinfo t
where t.fsalary < 9999 and fage > 35
union
select 'fsalary<9999 and fage < 35', count(1)
from empinfo t
where t.fsalary < 9999 and fage < 35
)SELECT t.Ptype, COUNT(t.Ptype) num
FROM (select CASE
WHEN (fsalary > 9999 and fage > 35) THEN
'1st'
WHEN (fsalary > 9999 and fage < 35) THEN
'2nd'
WHEN (fsalary < 9999 and fage > 35) THEN
'3th'
ELSE
'4XX'
END AS Ptype
from empinfo) t
GROUP BY t.Ptype
4、表A字段如下
month person income
月份 人员 收入
要求用一个SQL语句(注意是一个)的处所有人(不区分人员)每个月及上月和下月的总收入
要求列表输出为
月份 当月收入 上月收入 下月收入select t.month as 月份,
sum(decode(t.month, '当月', t.income)) as 当月收入,
sum(decode(t.month, '上月', t.income)) as 上月收入,
sum(decode(t.month, '下月', t.income)) as 下月收入
from A t
group by t.month
5,表B
C1 c2
2005-01-01 1
2005-01-01 3
2005-01-02 5要求的处数据
2005-01-01 4
2005-01-02 5
合计 9
试用一个Sql语句完成。
select to_char(t.c1,'YYYY-MM-DD'), sum(t.c2)
from b t
group by t.c1
union
select '合计', sum(t2.c5)
from (select t.c1, sum(t.c2) c5 from b t group by t.c1) t2
2、select * from table1 where fid in (
select fid from table1 group by fid having count(distinct fno)>1))
3、select count(case when fsalary>9999 and fage > 35 then 1 end ) 第一种
count(case when fsalary>9999 and fage < 35 then 1 end ) 第二种
count(case when fsalary<9999 and fage > 35 then 1 end ) 第三种
count(case when fsalary<9999 and fage < 35 then 1 end ) 第四种 from empinfo
4、 select a.*,b.incomeall 下个月,c.incomeall 上个月 from (select month,sum(income) incomeall from te group by month) a,
(select month,sum(income) incomeall from te group by month) b , (select month,sum(income) incomeall from te group by month) c
where a.month=add_months(b.month(+),1)
and a.month=add_months(c.month(+),-1)
5、select decode(month,null,'总计',month),sum(income) from te group by rollup(month)
2、count(no) group by id having count(no) > 1
3、decode
4、分析函数
5、rollup
6 7 8 9不会
10、minus
11 12 13 14不会
15 connect by
-----
不小的,什么玩意儿???
是不能实现的最大到100,写1000也只到100