oracle sql 複雜語句

2021-10-01 17:35:32 字數 443 閱讀 6619

1.oracle行轉列,pivot函式和unpivot函式

2.start with connect by prior 

遞迴查詢用法

[樹形結構的資料-例如組織機構樹]

3.資料誤刪恢復

select

* from

表名稱 as of timestamp to_timestamp(

'2020-05-07 08:00:00',

'yyyy-mm-dd hh24:mi:ss')

該語句可查詢該錶 2020-05-07 08:00:00截止表中的資料

4.oracle中如何查詢乙個表的所有欄位名和資料型別

select a.column_name,a.data_type  from user_tab_columns a

where table_name='表名'

常用oracle sql語句

建立表空間 alter tablespace nm offline drop tablespace nm including contents and datafiles drop user nmcascade create tablespace nm datafile 1 size 500m au...

Oracle SQL語句優化

1,建表時 1 建立主鍵 2 建立索引 3 如果表資料量很大考慮建立分割槽 4 可以使用number型別的就不適用varchar2,這是因為引擎在處理查詢和連線時會逐個比較字串中每乙個字元,而對於數字型而言只需要比較一次就夠了。2,建立索引注意事項 1 首先應考慮在 where 及 order by...

oracle sql 語句 記錄備忘

1.複製表結構及其資料 create table table name new as select from table name old 2.只複製表結構 create table table name new as select from table name old where 1 2 3.只...