ORACLE特殊查詢

2022-12-21 14:55:14 字數 956 閱讀 5298

1樓:賓士

[sys@orcl] sql>with t1 as(2 select 1 a, 1 b,2 c from dual3 union all

4 select 1,3,4 from dual5 union all

6 select 2,3,7 from dual7 union all

8 select 2,6,8 from dual9 union all

10 select 3,2,9 from dual11 union all

12 select 3,10,12 from dual13 ),t2 as(select a,b,c,nvl(lag(c)over(partition by a order by b),b) last_c from t1

14 ) select * from t1 where a in(select a from t2 where b < last_c)

15 order by a,b;

a b c---------- ---------- ----------2 3 72 6 8

2樓:匿名使用者

select t2.a, t2.b, t2.cfrom (select a, min(c) c from tab group by a) t1, tab t2

where not exists (select 1 from tab where a = t1.a and b > t1.c)

and t2.a = t1.a

即可 +....1....+....2....+a b c

2 3 7

2 6 8

oracle如何查詢檢視名稱,oracle裡怎麼查詢已經建好的檢視語句

用oracle enterprise manager console登入進去,選擇你要查詢檢視的資料庫,選擇方案 選擇和你連線oracle使用者相同的方案,第一個為表,第二個為索引,第三個就是檢視,在這裡可以檢視,也可以修改。select from dba views user views,all ...

關於oracle統計查詢

select sum decode type型別,1 1,0 型別1,sum decode type型別,2 1,0 型別2,sum decode type型別,3 1,0 型別3,date from car where date between to date 2010 1 5 yyyy mm d...

oracle資料庫密碼過期時間查詢

sqlplus sys password as sysdba 這個是作為管理員登陸 把oracle密碼預設天數修改為無限制 select from dba profiles where profile default and resource name password life time alte...