---设置日期语言
SQL> select sysdate from dual;
SYSDATE
--------------
23-8月 -10
SQL> alter session set nls_date_language='AMERICAN';
会话已更改。
SQL> select sysdate from dual;
SYSDATE
------------
23-AUG-10
---Oracle随机数的方法DBMS_RANDOM.VALUE
dbms_random.value(100,200)可以产生100到200范围的随机数
---SYS_GUID (),是Oracle 8i 后提供的函数。SYS_GUID产生并返回一个全球唯一的标识符(原始值)由16个字节组成
----随机抽取N条记录
select * from (select * from test01 order by dbms_random.value) where rownum<6
select * from (select * from test01 order by sys_guid()) where rownum<6
---抽取从N行到M行的记录,如3到5行的记录
select * from (select rownum rid, t.* from test01 t) where rid between 3 and 5
---抽取重复记录
select count(*),t.id from test01 t
group by t.id
having count(*)>1
--------SCOTT用户下,左外连接,右外连接,全外连接
select a.deptno,b.dname
from emp a, dept b
where a.deptno=b.deptno(+)
select a.deptno,b.dname
from emp a left outer join dept b
on a.deptno=b.deptno
select a.deptno,b.dname
from emp a, dept b
where a.deptno(+)=b.deptno
select a.deptno,b.dname
from emp a right outer join dept b
on a.deptno=b.deptno
select a.deptno,b.dname
from emp a full outer join dept b
on a.deptno=b.deptno
--或者
select a.ename,a.deptno,b.dname
from emp a full outer join dept b
using (deptno)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21684882/viewspace-671726/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21684882/viewspace-671726/