Oracle 使用筆記

2021-06-22 14:43:08 字數 1335 閱讀 3681

原理: 

for each row r_a in table_a (outer table)

for each rowr_bintable_b(inner table)ifr_ajoin withr_bthen

return (r_a

,r_b

)

適用範圍:

a.outer table很小; or

b.inner table

在join條件上有index.

原理: 

get first row t1r from table1

get first row t2r from table2

while not end of table1 and not end of table2

if t1r joins with t2r

get next row from table2

returns (t1r, t2r)

else t1r < t2r

get next row from table1

else

get next row from table2

end loop

適用範圍:

a.  table 1 和 table2 都按join key排好序;

原理:

partion table1 into several buckets pa_1, pa_2, ..., pa_n by hash key;

partion table1 into several bucketspb_1, pb_2, ..., pb_nby hash key;

fori = 1 to n

joinpa_iwith

pb_i and get joined result as j_imerge j_i and retun

適用範圍:

a.表的尺寸較大;

b. db的cpu和記憶體充足。

描述:指示優化器將內聯檢視實體化————執行過程中會建立基於檢視的臨時表。

好處: 相同子查詢可多次被使用

oracle使用筆記

1 scott解鎖 alter user scott identified by tiger alter user scott account unlock 2 導表 d oracle table.sql 3 檢視表結構 desc table 4 連線資料 hello world 5 去重 dist...

oracle使用筆記

一.判斷某個欄位是另外的值的時候,返回另外的值 decode函式 decode value,if1,then1,if2,then2,if2,then2,else 表示如果value等於if1時,decode函式的結果返回then1,如果不等於任何乙個if值,則返回else。參考文章 二.oracle...

Oracle使用筆記

1.nvl 函式 lnv val,rep val if val 字段值 null 返回 rep val 例 user表 id name age 1 atimo 18 2 null 20 select nvl name,sys name from user where id 2 結果 sys name...