自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

DB2數(shù)據(jù)庫(kù)中如何實(shí)現(xiàn)Oracle的某些功能

數(shù)據(jù)庫(kù)
DB2數(shù)據(jù)庫(kù)是IBM出口的一系列關(guān)系型數(shù)據(jù)庫(kù)管理系統(tǒng),分別在不同的操作系統(tǒng)平臺(tái)上服務(wù)。DB2數(shù)據(jù)庫(kù)功能性是很強(qiáng)大的,那么如何在DB2數(shù)據(jù)庫(kù)中實(shí)現(xiàn)Oracle的某些功能?

導(dǎo)讀:在現(xiàn)實(shí)的應(yīng)用中大家可能經(jīng)常會(huì)遇到在DB2數(shù)據(jù)庫(kù)中如何實(shí)現(xiàn)Oracle的某些功能﹐在此我簡(jiǎn)單地總結(jié)一下﹐實(shí)現(xiàn)某一功能可能會(huì)有很多種方法﹐在此就沒(méi)有全部列出﹐歡迎大家繼續(xù)﹐以便和大家共享﹐共同探討﹐共同近步﹗(以下主要以O(shè)racle8I和DB2 7.X為例)。

  1.如何取一表前n筆記錄的Oracle和DB2的寫(xiě)法

  Oracle 可以這樣實(shí)現(xiàn)﹕

  Select * from user.bsempms where rownum<=n;

  DB2 可以這樣實(shí)現(xiàn)﹕

  Select * from db2admin.bsempms fetch first n rows only;

  另外也可以用 row_number() over() 去實(shí)現(xiàn)的;

  2.如何取得當(dāng)前日期的Oracle和DB2的寫(xiě)法

  Oracle 可以這樣實(shí)現(xiàn)﹕

  Select sysdate from dual;

  DB2 可以這樣實(shí)現(xiàn)﹕

  Select current timestamp from sysibm.sysdummy1;

  3.如何連接字段的Oracle和DB2的寫(xiě)法

  Oracle 可以這樣實(shí)現(xiàn)﹕

  Select emp_no||emp_nam from bsempms;

  Select concat(emp_no,emp_nam) from bsempms;

  DB2 可以這樣實(shí)現(xiàn)﹕

  Select emp_no||emp_nam from db2admin.bsempms;

  select emp_no concat emp_nam from db2admin.bsempms;

  4.如何查詢(xún)表的結(jié)構(gòu)的Oracle和DB2的寫(xiě)法

  Oracle 可以這樣實(shí)現(xiàn)﹕

  Select sysdate from dual;

  DB2 可以這樣實(shí)現(xiàn)﹕

  Select current timestamp from sysibm.sysdummy1;

  5.內(nèi)連接INNER JOIN的Oracle和DB2的寫(xiě)法

  Oracle可以這樣實(shí)現(xiàn)﹕ Select a.* from bsempms a,bsdptms b where a.dpt_no=b.dpt_no; DB2 可以這樣實(shí)現(xiàn)﹕ Select * from db2admin.bsempms inner join db2admin.bsdptms on db2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;

  6.外連接的Oracle和DB2的寫(xiě)法(右外連接,左外連接,完全外連接,組合外連接)

  Oracle可以這樣實(shí)現(xiàn)﹕

  Select a.* from bsempms a,bsdptms b where a.dpt_no=b.dpt_no(+);

  Select a.* from bsempms a,bsdptms b wherea.dpt_no(+)=b.dpt_no;

  DB2 可以這樣實(shí)現(xiàn)﹕

  Select * from db2admin.bsempms right outer join db2admin.bsdptms

  on db2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;

  Select * from db2admin.bsempms left outer join db2admin.bsdptms

  on db2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;

  Select * from db2admin.bsempms full outer join db2admin.bsdptms

  on db2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;

  7.如何執(zhí)行腳本SQL文件的Oracle和DB2的寫(xiě)法

  Oracle 可以這樣實(shí)現(xiàn)﹕

  SQL>@$PATH/filename.sql;

  <>BDB2 可以這樣實(shí)現(xiàn)﹕

  db2 -tvf $PATH/filename.sql 文件中每行以 ; 結(jié)尾
 

上文中介紹的在DB2數(shù)據(jù)庫(kù)中實(shí)現(xiàn)Oracle的某些功能的方法并不是很全面的,如果大家有更好的方法,可以拿出來(lái)與大家一起分享。

【編輯推薦】

  1. 深入了解IBM DB2數(shù)據(jù)庫(kù)的數(shù)據(jù)移動(dòng)
  2. 講解Oracle系統(tǒng)中用戶(hù)權(quán)限的賦予和查看
  3. Oracle數(shù)據(jù)庫(kù)共享連接和專(zhuān)用連接方式比較
責(zé)任編輯:迎迎 來(lái)源: 天極網(wǎng)
相關(guān)推薦

2010-07-30 09:22:54

DB2實(shí)現(xiàn)

2010-09-07 16:16:04

DB2數(shù)據(jù)庫(kù)

2010-08-04 11:18:09

2010-11-03 16:32:10

DB2創(chuàng)建數(shù)據(jù)庫(kù)

2010-08-26 15:22:36

DB2新功能

2010-08-26 16:15:25

DB2數(shù)據(jù)庫(kù)管理

2009-08-07 15:26:38

C#數(shù)據(jù)庫(kù)編程實(shí)例

2010-08-04 11:38:24

Oracle數(shù)據(jù)庫(kù)

2010-08-16 13:45:27

安裝DB2數(shù)據(jù)庫(kù)

2010-08-18 15:31:30

DB2數(shù)據(jù)庫(kù)恢復(fù)

2011-03-15 11:19:45

DB2數(shù)據(jù)庫(kù)catalog

2010-09-01 10:17:14

DB2日志

2010-07-30 09:30:14

DB2數(shù)據(jù)庫(kù)

2011-03-11 16:02:03

DB2數(shù)據(jù)庫(kù)安裝

2010-08-16 16:23:56

DB2卸載

2010-08-10 10:07:29

DB2 數(shù)據(jù)庫(kù)

2010-09-01 15:23:59

DB2字段類(lèi)型

2010-07-28 13:38:34

DB2數(shù)據(jù)庫(kù)

2010-02-04 09:50:11

DB2Oracle數(shù)據(jù)

2010-08-26 11:32:25

DB2時(shí)間函數(shù)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)