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

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

數(shù)據(jù)庫(kù)
本文作者主要是和大家一起分享了一些自己在DB2數(shù)據(jù)庫(kù)中實(shí)現(xiàn)Oracle某些功能的一些技巧與心得,以下就是文章的主要內(nèi)容講述。

在實(shí)際操作中大家可能經(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數(shù)據(jù)庫(kù)的寫(xiě)法

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

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

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

  1. 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)﹕

  1. Select sysdate from dual;  

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

  1. Select current timestamp from sysibm.sysdummy1; 

3.如何連接字段的Oracle和DB2數(shù)據(jù)庫(kù)的寫(xiě)法

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

  1. Select emp_no||emp_nam from bsempms; Select concat(emp_no,emp_nam) from bsempms;  

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

  1. Select emp_no||emp_nam from db2admin.bsempms; select emp_no concat emp_nam from db2admin.bsempms; 

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

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

  1. Select sysdate from dual; 

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

  1. Select current timestamp from sysibm.sysdummy1; 

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

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

  1. Select a.* from bsempms a,bsdptms b where a.dpt_no=b.dpt_no;  

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

  1. Select * from db2admin.bsempms inner join db2admin.bsdptms on db2admindb2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no; 

6.外連接的Oracle和DB2數(shù)據(jù)庫(kù)的寫(xiě)法(右外連接,左外連接,完全外連接,組合外連接)

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

  1. 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)﹕

  1. Select * from db2admin.bsempms right outer join db2admin.bsdptms on db2admindb2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;   
  2. Select * from db2admin.bsempms left outer join db2admin.bsdptms on db2admindb2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;   
  3. Select * from db2admin.bsempms full outer join db2admin.bsdptms on db2admindb2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;  

以上的相關(guān)內(nèi)容就是對(duì)DB2數(shù)據(jù)庫(kù)中實(shí)現(xiàn)Oracle相關(guān)功能的介紹,望你能有所收獲。

【編輯推薦】

  1. 實(shí)現(xiàn)DB2HADRv8.2 EE實(shí)施的正確操作步驟
  2. DB2 LOAD命令所提供的選項(xiàng)及注冊(cè)表變量大全
  3. DB2快照函數(shù)全解析經(jīng)典版
  4. DB2在線增量備份 還原增量備份及前滾恢復(fù)
  5. DB2:信息管理 盡在掌握
責(zé)任編輯:佚名 來(lái)源: 51CTO.com
相關(guān)推薦

2011-03-25 14:53:39

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

2010-08-03 10:16:15

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

2010-08-27 14:48:22

DB2like

2010-08-05 14:03:46

連接ibm DB2

2010-07-30 09:22:54

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

2010-08-12 09:41:06

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

2010-07-28 10:28:47

DB2數(shù)據(jù)移動(dòng)

2010-08-04 11:18:09

2010-05-10 16:25:15

Oracle組件

2010-08-11 08:39:57

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

2010-08-31 14:13:48

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

2010-08-03 14:20:26

2010-08-18 10:04:54

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

2010-07-28 11:05:57

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

2010-08-05 09:53:35

2010-07-30 09:57:31

2010-08-05 17:33:54

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

2010-08-17 09:11:42

DB2數(shù)據(jù)庫(kù)備份性能

2010-08-26 16:00:31

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

2010-11-03 16:32:10

DB2創(chuàng)建數(shù)據(jù)庫(kù)
點(diǎn)贊
收藏

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