哪位高手能帮忙解下这两道Oracle题, 1写出10条动态视图(一条一分)。2. 有表1: type state wage a 1 50 a 2 100 a 3 150 a 4 200 s 8 300 s 9 400 s 12 500 表2,如下: type start end sum a 1 4 500 s 8 9 700 s 12 12 500 写出从表1到表2的操作语句。12.写出10条动态视图(一条一分)。
试了半天只能做到下面这样子select type1,min(type2) as state,max(type2) as end,sum from( select type1, lead(state) over(partition by type1 order by state ) as type2, sum(wage) over(partition by type1) as sum from t1) group by type1,sum 结果: 1 a 2 4 500 2 s 9 12 1200期待高手出来
from(
select type1, lead(state) over(partition by type1 order by state ) as type2, sum(wage) over(partition by type1) as sum
from t1)
group by type1,sum
结果:
1 a 2 4 500
2 s 9 12 1200期待高手出来
http://topic.csdn.net/u/20081002/00/f8d90ba2-e2bb-412a-a0c5-1b6d518fc22a.html
v$sql ; v$session;v$process; v$database;v$instance;v$locked_object;v$segment_statistics;v$parameter;v$datafile;v$services
2、SQL>
SQL> select type, min(state) "start", max(state) "end", sum(wage) "sum"
2 from t
3 group by type, (state - rownum);
TYPE start end sum
---------- ---------- ---------- ----------
a 1 4 500
s 12 12 500
s 8 9 700