Select * from db2admin.bsempms fetch first n rows only;
另外也可以用 row_number() over() 去实现的;
2.如何取得当前日期的Oracle和DB2的写法
Oracle 可以这样实现﹕
Select sysdate from dual;
DB2 可以这样实现﹕
Select current timestamp from sysibm.sysdummy1;
3.如何连接字段的Oracle和DB2的写法
Oracle 可以这样实现﹕
Select emp_no||emp_nam from bsempms;
Select concat(emp_no,emp_nam) from bsempms;
DB2 可以这样实现﹕
Select emp_no||emp_nam from db2admin.bsempms;
select emp_no concat emp_nam from db2admin.bsempms;
4.如何查询表的结构的Oracle和DB2的写法
Oracle 可以这样实现﹕
Select sysdate from dual;
DB2 可以这样实现﹕
Select current timestamp from sysibm.sysdummy1;
5.内连接INNER JOIN的Oracle和DB2的写法
Oracle可以这样实现﹕ Select a.* from bsempms a,bsdptms b where a.dpt_no=b.dpt_no; DB2 可以这样实现﹕ Select * from db2admin.bsempms inner join db2admin.bsdptms on db2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;
6.外连接的Oracle和DB2的写法(右外连接,左外连接,完全外连接,组合外连接)
Oracle可以这样实现﹕
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 可以这样实现﹕
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;