易截截图软件、单文件、免安装、纯绿色、仅160KB

写ORACLE SQL

一.按英文字母排序:
        select * from table order by nlssort(name,'NLS_SORT=schinese_pinyin_M');
 二. 写一个SQL语句,查询选修了5门课程的学生学号和姓名(9分钟)
答:SQL语句如下:
select stu.sno, stu.sname
from student stu
where (select count(*) from sc where sno=stu.sno) = 5;
三. 在SQL中删除重复记录的方法:(用到rowid (oracle伪列))
1)通过建立临时表来实现
SQL>create table temp_emp as (select distinct * from employee) 
SQL>truncate table employee; (清空employee表的数据)
SQL>rename temp_emp to employee; (再将表重命名)
2)通过使用rowid来实现。
SQL>delete from employee where rowid not in (
         select max(t1.rowid) from employee t1 group by
         t1.emp_id,t1.emp_name,t1.salary);--这里用min(rowid)也可以。
四. TOP N问题:(用到rownum (oracle伪列))
--rownum只能使用<=或<的关系比较运算符
select * from s_emp where rownum <= 2;
--查询公司工资最高的3个人
/*select * from emp
where rownum <= 3
order by sal desc;*/ 错误的
select * from (select * from emp order by sal desc)
     where rownum <= 3;
五.分页查询:
   --查询第1-5条记录
    select * from (select rownum num, s_emp.* from s_emp)
    where num >=1 and num <= 5;


相关文档:

oracle 10g pl/sql 学习

选择10g是因为对网格技术比较好奇,好像还没得到广泛应用,也就无所谓与前面版本有很大区别了。
在迅雷上下了个软件,运行sqlplusw,然后照着书,狂敲了一翻,有在网上下了个视频教程(MLDN魔乐科技_Oracle课堂),讲得挺好的,就是时间长了点,不如看书来得快。反正现在只是想熟悉一下基本语句。
看了两天书了。了解了一 ......

ORACLE PL/SQL子程序

温故而知新,果然如此呀,第二次再翻开同样的内容果然有不同的收获,有些是第一次看的时候没有仔细理解的,还有些可能是在第一次看匆匆就跳过的,当然,可能还有部分是自己当时记住了完了又给忘记了。今天第二次看到子程序这一章节,发现了些新的内容,呵呵。在这里我就写下一些基本内容和容易忘记的,免得下次又给忘了。内 ......

Oracle 更改表空间位置的具体步骤

[oracle]> sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 – Production on Tue Aug 19 03:46:29 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> shutdown immediate
ORA-01109: database not open
Da ......

One good feature flashback of oracle 10g

1. use database as archive log mode and set archive dest location
alter system set LOG_ARCHIVE_DEST_1 = 'LOCATION=/u04/arch/orcl' scope=spfile;
2. configuration retention days/size/distination
ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=43200; --30 days
ALTER SYSTEM SET db_recovery_file_dest_ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号