- 浏览: 66747 次
- 性别:
- 来自: 成都
-
文章分类
- 全部博客 (74)
- HttpSessionListener (1)
- HttpSessionBindingListener (1)
- HttpSessionAtributeListener (1)
- 把map中的值全部打印出来 (1)
- 编程面试题 (1)
- 应对java中文乱码的妙招 (1)
- Java读取TXT文本文件乱码解决方案 (1)
- DWR中文文档下载 (1)
- JAVA的反射机制与动态代理下载 (1)
- Map Demo (1)
- jsp (1)
- js (1)
- html页面定时刷新 (1)
- JsonUtil (1)
- Map.Entry (1)
- javascript mvc框架backbone.js 初探 (1)
- 使用Spring JavaMail发送邮件总结 (1)
- 对web.xml 的几点配置心得。包括mime-mapping (1)
- oracle SQL记录 (1)
- partition by 与group by 区别 (1)
- Java中堆与栈的区别 (1)
- java类型转换 (1)
- 深入研究ReentrantLock(重入锁)之引出话题篇 (1)
- WebLogic JMS 编程 (1)
- UML软件工程组织 (1)
- cmd (1)
- 依赖注入就是为了解耦,让模块彼此都不直接依赖,而是都依赖于Spring容器。 (1)
- ibatis (0)
最新评论
-
cherishlive:
学习了,多谢。
Oracle递归查询 start with..
select 2*3 from dual; --求年薪 select ename,sal, sal*12 from emp; --别名 select ename,sal, sal*12 as "年薪" from emp; select ename,sal, sal*12 "年薪" from emp; --员工一年总收入 select * from emp; select ename,sal, sal*12+comm as "年总收入" from emp; --注意:含有任何null值的数学表达式最后的结果都为null --字符串连接符 || select ename||'员工姓名' from emp; --处理一个字符串中含有单引号的情况 :使用2个单引号表示一个单引号 select ename||'员工''姓名' from emp; --含有任何null值的字符串表达式中,null被当作空字符串处理 select empno, ename||mgr from emp; --求员工每个级别顶薪 select hisal*12 as "员工年顶薪" from salgrade; /* distinct 消除重复值 */ --求emp表中的部门列表 select distinct deptno from emp; select deptno, job from emp; select distinct deptno, job from emp;--去除deptno, job 组合起来的重复值 --null值 --求奖金为null的员工信息 select * from emp where comm is null; --求奖金不为null的员工信息 select * from emp where comm is not null; /* in */ --求员工编号在某一个集合内的值 select * from emp where empno in (7369,7499,7521) select * from emp where empno not in (7369,7499,7521) /* oracle 日期 */ select * from emp; --求入职日期在1982-1-23后入职的人 select * from emp where hiredate > '23-1月-82'; /* like */ --查询员工 名字第二个字面为A的人 select * from emp where ename like '_A%'; --查询名字中含有 % 等通配符的数据时,使用转义字符 \ (\%) select * from emp where ename like '%\%%'; --查询1987年入职的人 select * from emp where hiredate>='1-1月-87' and hiredate<='31-12月-87'; select * from emp where hiredate like '%87%' /* order by*/ select * from emp order by deptno asc,sal desc; /*常用函数*/ --lower() select empno, Lower(ename) from emp; --查询名字带有 “A“ 或 "a"的员工 select * from emp where ename like '%A%' or ename like '%a%'; select * from emp where Lower(ename) like '%a%'; --Upper(); 小写转大写 select Upper('wepull') from dual; --Substr select Substr('wepull',2,3) from dual; --epu select Substr('wepull',2) from dual; --epull select Substr(ename,2) from emp; --Chr() 某个ASCII码值对应的字符 select Chr(97) from dual; -- a -- Ascii()函数 --例子:求一个字符的ASCII码值 select Ascii('a') from dual; --97 --常用数值函数 select round(23.652) from dual --24 select round(23.652,2) from dual --23.65 select round(23.652,-1) from dual --20 select round(493.652,-2) from dual --500 --to_char() select to_char(456123.45,'L999,999.99') from dual-- ¥456,123.00 --to_char()对日期的转换 select sysdate from dual; select to_char(sysdate,'YYYY/MM/DD') from dual; --to_date()函数 --例子:将1985年2月14日8:00以后入职的雇员信息取出 select * from emp where hiredate > to_date('1985-02-14 8:00','YYYY-MM-DD HH:MI') --to_number()函数 --求薪水<于1200的人 select * from emp where sal<to_number('$1,200','$9,999') --nvl 处理空值 select ename, sal*12+comm as "一年总收入" from emp select ename, sal*12+nvl(comm,0) as "一年总收入" from emp ---聚合函数/组函数 select * from emp; --emp表中deptno数量 select count(deptno) from emp; select count(distinct deptno) as "部门总数" from emp; --group by --求每个部门的最大工资 select deptno ,max(sal) from emp group by deptno; --求每个部门中职位的最大工资 select deptno ,job,max(sal) from emp group by deptno , job; ---求每个部门工资最高人信息 select ename,deptno,sal from emp where (deptno,sal)in (select deptno ,max(sal) from emp group by deptno); --方法二 select * from emp join (select deptno ,max(sal) max_sal from emp group by deptno ) t on (emp.deptno=t.deptno and emp.sal=t.max_sal) --having select deptno, avg(sal) from emp group by deptno having avg(sal)>2500 ---子查询 --求工资最高的人的信息 select * from emp where sal=( select max(sal) from emp ); --rownum(分页) --查询emp表前5条记录 select ename,rownum from emp where rownum<=5; --查询emp表第5条以后记录 select * from (select empno, ename,rownum as r from emp) where r>5; --rownum 与排序 select empno,ename,sal ,rownum from emp order by sal; select empno,ename,sal ,rownum from (select empno,ename,sal from emp order by sal) 上司 --自连接 --求emp表中员工的姓名和对应的上司(mgr) select * from emp; select e1.ename, e2.ename from emp e1,emp e2 where e1.mgr=e2.empno; --交叉连接 select ename from emp; select dname from dept; select ename,dname from emp ,dept; --结果为笛卡尔乘积 --SQL1999 语法 select ename,dname from emp cross join dept; --连接查询 create table a( id int primary key, name nvarchar2(20) ); select * from a; insert into a values (1,'凤姐'); insert into a values (3,'犀利哥'); insert into a values (5,'春哥'); insert into a values (6,'曾哥'); insert into a values (7,'平平'); create table b( id int primary key, info nvarchar2(20) ) insert into b values (1,'深圳'); insert into b values (2,'武汉'); insert into b values (6,'成都'); select * from a; select * from b; select * from a left outer join b on a.id=b.id;--左外连接 select * from a right outer join b on (a.id=b.id);--右外连接 select * from a full join b on (a.id=b.id);--全连接 (左外连接+右外连接) select * from a inner join b on (a.id=b.id) --内连接 --非等值连接 --查询出雇员名字和薪水等级(2个表连接查询) select * from emp; select * from salgrade; select e.ename ,e.sal ,s.grade from emp e join salgrade s on (e.sal between s.losal and s.hisal) --查询出雇员名字,及对应的部门名称,薪水等级(3个表连接查询) select e.ename, d.dname, s.grade from emp e join dept d on(e.deptno=d.deptno) join salgrade s on (e.sal between s.losal and s.hisal) --练习 --求部门中薪水最高的人名。 select * from emp e; select e.deptno, max(e.sal) from emp e group by deptno ; select e.ename ,t.deptno,e.sal from emp e join (select e.deptno, max(e.sal) max_sal from emp e group by deptno) t on (e.deptno=t.deptno and e.sal =max_sal) --求部门平均薪水等级? select deptno, avg(sal) from emp e group by deptno; select * from salgrade; select t.deptno, t.avg_sal, s.grade from salgrade s join (select deptno, avg(sal) avg_sal from emp e group by deptno) t on(t.avg_sal between s.losal and s.hisal ); --求哪些人是经理 select * from emp; select * from emp where mgr in (select mgr from emp); select * from emp where mgr in (select distinct mgr from emp); --平均薪水最高的部门编号与薪水 --第一步:先求出部门平均薪水 select e.deptno ,avg(sal) from emp e group by e.deptno; --第二步:求出平均薪水最高值 select max(t.avg_sal) from (select e.deptno ,avg(sal) avg_sal from emp e group by e.deptno) t --综合 select deptno ,avg_sal from (select e.deptno ,avg(sal) avg_sal from emp e group by e.deptno) t where t.avg_sal = ( select max(t.avg_sal) from (select e.deptno ,avg(sal) avg_sal from emp e group by e.deptno) t ) --方法二: select deptno ,avg_sal from (select e.deptno ,avg(sal) avg_sal from emp e group by e.deptno) t where avg_sal =(select max(avg(sal)) from emp group by deptno ) --注意 :组函数嵌套只能嵌套2层 select * from emp; --比普通员工的最高薪水还要高的经理人名称 -- 1.先求普通员工的最高薪水? select max(sal) from emp e where e.empno not in (select mgr from emp where mgr is not null ) --2.求比上面的值要大,并且还是经理人 select e.ename,e.sal from emp e where e.empno in (select distinct mgr from emp where mgr is not null ) and e.sal> ( select max(sal) from emp e where e.empno not in (select distinct mgr from emp where mgr is not null ) ); --复制表 create table emp as select * from scott.emp where 1<>1;--只复制结构 create table emp as select * from scott.emp ;--复制数据 create table dept as select * from scott.dept ; create table salgrade as select * from scott.salgrade ; create table bonus as select * from scott.bonus ; select * from emp ---Orcle 高级部分 --视图 select * from scott.emp; create view emp_view as select empno, ename,sal from scott.emp; select * from emp_view; drop view emp_view; --查询每个部门的名称、总人数、平均工资、最低工资的员工名字。 select dept.dname from demp; select deptno, count(empno) ,avg(sal),min(sal) from emp group by deptno ; --综合: 3张表连接查询 select d.dname, t.deptno, t.c, t.avg_sal,t.min_sal ,e.ename from dept d join (select deptno, count(empno) c ,avg(sal) avg_sal,min(sal) min_sal from emp group by deptno ) t on (d.deptno=t.deptno) join emp e on (e.sal=t.min_sal and e.deptno=t.deptno) --把上面结果封装成视图 create or replace view deptInfo_view as select d.dname, t.deptno, t.c, t.avg_sal,t.min_sal ,e.ename from dept d join (select deptno, count(empno) c ,avg(sal) avg_sal,min(sal) min_sal from emp group by deptno ) t on (d.deptno=t.deptno) join emp e on (e.sal=t.min_sal and e.deptno=t.deptno) -- select * from deptinfo_view; --------- --外键约束 drop table t_type; create table t_type( id int primary key, typeName varchar2(20) ) drop table t_book; create table t_book( id int primary key, name varchar2(20) , tid int , constraint FK_tid foreign key (tid) references t_type(id)--字段级的外键约束,不用加foreign key ) -- select * from user_tables; select table_name from user_tables; insert into t_type values (1,'言情类'); insert into t_type values (2,'计算机类'); insert into t_type values (3,'言武侠类'); select * from t_book t insert into t_book values (1,'小磊子的情书',1); insert into t_book values (2,'凤姐的韵事',1); insert into t_book values (3,'干露露的视频',2); insert into t_book values (4,'java自学成才',2); insert into t_book values (5,'刘德华的情歌',3); -------- --视图中使用DML的规定(不重要) create or replace view book_view as select id,name from t_book; -- select * from t_book select * from book_view; delete from book_view where id=4; --只读视图 create or replace view book_view as select id,name from t_book with read only; --序列 create or replace sequence my_sec; select my_sec.nextval from dual; select my_sec.currval from dual; create sequence book_sec; create table book( id number, name varchar2(50) ) alter table book add constraint PK_id primary key (id) select * from book; insert into book values (book_sec.nextval,'111'); insert into book values (book_sec.nextval,'222'); insert into book values (book_sec.nextval,'333'); insert into book values (book_sec.nextval,'444'); create sequence se_1 increment by 50 --次增长的幅度 50 start with 100 --从100开始 maxvalue 400 --最大400 minvalue 50 cycle --到最大值后循环 cache 2; select se_1.nextval from dual --索引 create index idx_book on book(name); drop index idx_book; --同义词 t_book create synonym t for t_book select * from t; drop synonym t; --- PL/SQL begin dbms_output.put_line('hello word'); end; --变量赋值 declare v_name varchar2(20):='wepull'; begin dbms_output.put_line(v_name); end; --复合类型变量 --记录类型 declare --定义一个记录类型 type book_rec is record( id int, name varchar2(20) ); b_rec book_rec; --声明一个变量是记录类型 begin select id ,name into b_rec from wepull.t_book where id=1; dbms_output.put_line(b_rec.id||b_rec.name); end; --%type declare v_id wepull.t_book.id%type ;--定义的变量v_id类型与t_book中的id列的类型一致 v_name wepull.t_book.name%type; begin /* v_id:=1; v_name:='wepull'; */ select id ,name into v_id,v_name from wepull.t_book where id=1; dbms_output.put_line(v_id); dbms_output.put_line(v_name); end; --rowtype declare v_book wepull.t_book%rowtype ;--定义的变量v_book类型与t_book中列的类型一致 begin select * into v_book from wepull.t_book where id=1; dbms_output.put_line('id: '||v_book.id); dbms_output.put_line('name: '||v_book.name); dbms_output.put_line('tid: '||v_book.tid); end; --嵌套表 select * from t_book; select * from wepull.t_book; declare type book_table_type is table of wepull.t_book%rowtype;--定义类型 v_book book_table_type:=book_table_type(); begin v_book.extend(5); select * into v_book(1) from wepull.t_book where id=1; dbms_output.put_line(v_book(1).id||' '||v_book(1).name); select * into v_book(2) from wepull.t_book where id=2; dbms_output.put_line(v_book(2).id||' '||v_book(2).name); end; / --流程控制语句 --if --单个if --1.查询用户输入的id的图书,如果图书的tid=1 则输出图书类型为言情类 declare v_id wepull.t_book.id%type:=&v_id; v_tid wepull.t_book.tid%type; begin select id,tid into v_id, v_tid from wepull.t_book where id=v_id; if (v_tid=1) then dbms_output.put_line('此id的图书为言情类'); end if; end; / --if else --1.查询用户输入的id的图书,如果图书的tid=1 则输出图书类型为言情类,否则输出不是言情类 declare v_id wepull.t_book.id%type:=&v_id; v_tid wepull.t_book.tid%type; begin select id,tid into v_id, v_tid from wepull.t_book where id=v_id; if (v_tid=1) then dbms_output.put_line(v_id|| ' :此id的图书为言情类'); else dbms_output.put_line(v_id|| ' :此id的图书不是言情类'); end if; end; / -- --if elsif --1.查询用户输入的id的图书, --如果图书的tid=1 则输出图书类型为言情类, --如果图书的tid=2 则输出图书类型为计算机类 --如果图书的tid=3 则输出图书类型为言武侠类 select * from wepull.t_type; declare v_id wepull.t_book.id%type:=&v_id; v_tid wepull.t_book.tid%type; begin select id,tid into v_id, v_tid from wepull.t_book where id=v_id; if (v_tid=1) then dbms_output.put_line(v_id|| ' :此id的图书为言情类'); elsif(v_tid=2)then dbms_output.put_line(v_id|| ' :此id的图书为计算机类'); elsif(v_tid=3)then dbms_output.put_line(v_id|| ' :此id的图书为武侠类'); end if; end; / --case declare v_id wepull.t_book.id%type:=&v_id; v_tid wepull.t_book.tid%type; v_typeName wepull.t_type.typeName%type; begin select tid into v_tid from wepull.t_book where id = v_id; v_typeName := case v_tid when 1 then '言情类' when 2 then '计算机类' when 3 then '武侠类' else '其他类' end; dbms_output.put_line('id: '||v_id); dbms_output.put_line('tid: '||v_tid); dbms_output.put_line('typeName: '||v_typeName); end; / -- --case 搜索方式 declare v_id wepull.t_book.id%type:=&v_id; v_tid wepull.t_book.tid%type; v_typeName wepull.t_type.typeName%type; begin select tid into v_tid from wepull.t_book where id = v_id; v_typeName := case when v_tid=1 then '言情类' when v_tid=2 then '计算机类' when v_tid=3 then '武侠类' else '其他类' end; dbms_output.put_line('id: '||v_id); dbms_output.put_line('tid: '||v_tid); dbms_output.put_line('typeName: '||v_typeName); end; / --循环 --循环1---Loop --求 1+2+....+100=? declare v_i number:=0; v_sum number:=0; begin loop v_i:=v_i+1; v_sum:=v_sum+v_i; exit when(v_i=100); end loop; dbms_output.put_line('1+2+....+100='||v_sum); end; / --循环1---while --求 1+2+....+100=? declare v_i number:=0; v_sum number:=0; begin while(v_i<100) loop v_i:=v_i+1; v_sum:=v_sum+v_i; end loop; dbms_output.put_line('1+2+....+100='||v_sum); end; / --循环1---for --求 1+2+....+100=? declare v_i number:=0; v_sum number:=0; begin for v_i in 1..100 loop v_sum:=v_sum+v_i; end loop; dbms_output.put_line('1+2+....+100='||v_sum); end; / -- declare v_i number:=0; v_sum number:=0; begin for int in 1..100 loop v_i:=v_i+1; v_sum:=v_sum+v_i; end loop; dbms_output.put_line('1+2+....+100='||v_sum); end; / --goto declare v_i number:=0; v_sum number:=0; begin for v_i in 1..10 loop dbms_output.put_line('当前i为: '||v_i); if(v_i=5) then goto endloop; end if; end loop; <<endloop>> dbms_output.put_line('此时v_i=5,退出了循环体'); end; --null语句 --goto declare v_i number:=0; v_sum number:=0; begin for v_i in 1..10 loop dbms_output.put_line('当前i为: '||v_i); if(v_i=5) then goto endloop; end if; end loop; <<endloop>> null; end; --游标 --使用游标取出emp表总前10人的信息。 select * from scott.emp; declare --第一步:声明游标 cursor emp_cursor is select * from scott.emp where rownum<=10; emp_record scott.emp%rowtype; begin --第二步:打开游标 open emp_cursor; --第三步:从游标中取数据 loop fetch emp_cursor into emp_record;--每取出一条数据,指针自动下移 exit when(emp_cursor%notfound);--最后次取数据失败 dbms_output.put_line(emp_record.empno|| ' ' ||emp_record.ename); end loop; --第四步:关闭游标 close emp_cursor; end; / --错误例子 declare --第一步:声明游标 cursor emp_cursor is select * from scott.emp where rownum<=10; emp_record scott.emp%rowtype; begin --第二步:打开游标 open emp_cursor; --第三步:从游标中取数据 loop fetch emp_cursor into emp_record;--每取出一条数据,指针自动下移 dbms_output.put_line(emp_record.empno|| ' ' ||emp_record.ename); exit when(emp_cursor%notfound);--最后次取数据失败 end loop; --第四步:关闭游标 close emp_cursor; end; / --使用游标取出emp表总前10人的信息。 while declare --第一步:声明游标 cursor emp_cursor is select * from scott.emp where rownum<=10; emp_record scott.emp%rowtype; begin --第二步:打开游标 open emp_cursor; --第三步:从游标中取数据 fetch emp_cursor into emp_record; while(emp_cursor%found)loop dbms_output.put_line(emp_record.empno|| ' ' ||emp_record.ename); fetch emp_cursor into emp_record; end loop; --第四步:关闭游标 close emp_cursor; end; / --使用游标取出emp表总前10人的信息。 for 必须掌握 declare --第一步:声明游标 cursor emp_cursor is select * from scott.emp where rownum<=10; emp_record scott.emp%rowtype; begin for emp_rec in emp_cursor loop dbms_output.put_line(emp_rec.empno|| ' ' ||emp_rec.ename); end loop; end; / --使用游标取出emp表总指定job 和 deptno的员工信息。 select * from scott.emp declare --第一步:声明游标 cursor emp_cursor(v_job scott.emp.job%type,v_deptno scott.emp.deptno%type) is select * from scott.emp where job=v_job and deptno=v_deptno; emp_record scott.emp%rowtype; begin for emp_rec in emp_cursor('CLERK',30) loop dbms_output.put_line(emp_rec.empno|| ' ' ||emp_rec.ename); end loop; end; / --模糊查询 select PATINDEX('%abb%','abcaabbeeabb') from dual; select * from scott.emp where regexp_like(ename, '[AS]MITH');--SMITH select * from scott.emp where ename like 'SMITH'; --游标的update操作 --更新指定图书的名字 declare cursor book_cursor is select * from t_book for update; --v_id t_book.id%type:=v_id; v_name t_book.name%type:=&v_name; begin for book_rec in book_cursor loop if(book_rec.tid=1) then update t_book set name=v_name where current of book_cursor; end if; end loop; end; / --隐式游标(了解) --更新指定图书的名字,如果该图书没有找到,则打印”查无此图书”。 declare v_name t_book.name%type:=&v_name; v_id t_book.id%type:=&v_id; begin update t_book set name=v_name where id=v_id; if(sql%found) then dbms_output.put_line('修改成功: '||v_id||' '||v_name); elsif(sql%notfound) then dbms_output.put_line('没有指定id的图书 '); end if; end; / -------------存储过程 create or replace procedure p1 as v_name t_book.name%type:='言情'; v_id t_book.id%type:=1; begin update t_book set name=v_name where id =v_id; if(sql%found) then dbms_output.put_line('修改成功'); end if; end; / --调用存储过程 exec p1; select * from t_book; begin p1; end; / --带参数的存储过程 --求1...N的和 (N为入参) create or replace procedure p2(v_number in number) as v_sum number:=0; v_i number:=0; begin for v_i in 0..v_number loop v_sum:=v_sum+v_i; end loop; dbms_output.put_line(v_sum); end; --调用 begin p2(100); end; / --带参数的存储过程 --求1...N的和 (v_number为入参,v_sum为出参) create or replace procedure p3(v_number in number,v_sum out number) as begin v_sum :=0; for v_i in 0..v_number loop v_sum:=v_sum+v_i; end loop; dbms_output.put_line('存储过程中打印:'||v_sum); end; --调用 declare v_sum number; begin p3(100,v_sum); dbms_output.put_line('调用打印:'||v_sum); end; / --函数 无参 create or replace function my_fun return date as v_date date; begin select sysdate into v_date from dual; return v_date; end; / --调用 select my_fun() from dual; --- declare v_date date; begin v_date:=my_fun(); dbms_output.put_line(v_date); end; / --函数 带参数 --根据id查询出图书名字 create or replace function getName(v_id t_book.id%type) return t_book.name%type as v_name t_book.name%type; begin select name into v_name from t_book where id = v_id; return v_name; end; / --调用 declare v_name t_book.name%type; begin v_name:=getName(2); dbms_output.put_line(v_name); end; / --触发器 create table book_log( username varchar2(10), action varchar2(10), adate date ) select * from a; create or replace trigger trigger_book after insert or update or delete on scott.a begin if inserting then insert into book_log values (user,'insert',sysdate); elsif updating then insert into book_log values (user,'update',sysdate); elsif deleting then insert into book_log values (user,'delete',sysdate); end if; end; / --测试 select * from a; select * from book_log; insert into a values (8,'龙磊的铃声'); update a set name='龙磊' where id = 8; delete from a set name='龙磊' where id = 8; --行触发器 create or replace trigger trigger_book after insert or update or delete on scott.a for each row begin if inserting then insert into book_log values (user,'insert',sysdate); elsif updating then insert into book_log values (user,'update',sysdate); elsif deleting then insert into book_log values (user,'delete',sysdate); end if; end; / -- update a set name=name||'2'; delete from book_log; select * from book_log; select * from a; select * from emp; --异常处理(了解) declare v_empno scott.emp.empno%type:=&v_empno; v_emp_rec emp%rowtype; begin select * into v_emp_rec from scott.emp where scott.emp.empno=v_empno; dbms_output.put_line(v_emp_rec.empno||' '||v_emp_rec.ename); exception when no_data_found then dbms_output.put_line('没有此编号的员工 '); end; / declare v_deptno scott.emp.deptno%type:=&v_deptno; v_emp_rec emp%rowtype; begin select * into v_emp_rec from scott.emp where scott.emp.deptno=v_deptno; dbms_output.put_line(v_emp_rec.empno||' '||v_emp_rec.ename); exception when no_data_found then dbms_output.put_line('没有此编号的员工 '); when too_many_rows then dbms_output.put_line('select 语句返回了多行数据 '); end;
相关推荐
Oracle SQL是数据库管理员和开发人员用来与Oracle数据库交互的语言,它是SQL标准的扩展,提供了许多特有的功能和优化。本资源“Oracle Sql基础(beginning oracle sql中文版)”旨在为初学者提供一个全面的Oracle ...
Oracle SQL 是一种强大的数据库查询和编程语言,广泛用于管理和操作Oracle数据库系统。11g第二版(11G2)是Oracle的一个重要版本,提供了许多增强功能和优化。本官方文档集包括四份重要的参考资料,涵盖了Oracle SQL...
在“Oracle-SQL.rar”这个压缩包中,包含了一份名为“Oracle SQL.ppt”的文件,这可能是一个PowerPoint演示文稿,用于详细讲解Oracle数据库的基础知识和SQL语言的使用。下面,我们将深入探讨一些Oracle SQL的基础...
根据提供的文件信息,我们可以推断出这是一本关于Oracle SQL的专业书籍——《精通Oracle SQL 第2版》。接下来,我们将围绕这一主题展开深入探讨,包括Oracle SQL的基本概念、本书的主要内容以及学习Oracle SQL的一些...
### Oracle SQL Developer 使用教程 #### 一、Oracle Database Home Page 的使用 在开始介绍 Oracle SQL Developer 的使用之前,我们先来看看如何使用 Oracle Database Home Page。这部分内容非常重要,因为它是...
本文将详细讲解如何使用Oracle SQL Developer工具进行这样的迁移过程,以及如何解决在迁移过程中遇到的问题。 首先,确保你拥有正确的工具。在这个案例中,你需要MySQL 5.6.37、Oracle 11g以及Oracle SQL Developer...
Oracle SQL 内置函数大全 SQL中的单记录函数 给出整数,返回对应的字符 连接两个字符串 增加或减去月份 用于对查询到的结果进行排序输出
Oracle SQL编写规范 Oracle SQL编写规范是指在编写SQL语句时的一些基本原则和方法,旨在提高SQL语句的执行效率和可读性。以下是Oracle SQL编写规范的详细解释: 1. 尽量用索引,特别在从大量数据中返回小部分数据...
1. **SQL基础**:Oracle SQL遵循SQL标准,包括基本的SELECT语句用于查询数据,INSERT用于插入新记录,UPDATE用于修改现有记录,以及DELETE用于删除记录。理解这些基本操作是学习Oracle SQL的第一步。 2. **子查询**...
2. **历史查询分析**:记录并存储过去的SQL执行记录,便于对比不同时间点的性能变化,进行长期性能趋势分析。 3. **性能图表**:通过图表形式展示CPU使用率、I/O等待时间等关键指标,直观地揭示性能问题。 4. **...
### Oracle SQL*Plus 口袋参考手册第二版关键知识点概览 #### 1.1 引言 本书《Oracle SQL*Plus Pocket Reference, 2nd Edition》是一部针对Oracle SQL*Plus及其常用SQL查询和数据操作语句的快速参考指南。作者...
Oracle SQL,全称为结构化查询语言在Oracle数据库环境中的应用,是数据库管理员和开发人员用于检索、更新和管理Oracle数据库的核心工具。Oracle SQL是SQL标准的扩展,它提供了许多特有的功能,以满足企业级数据库...
- **集合思维**:Oracle SQL 强调的是集合操作而非行操作,即一次性处理多行记录而不是单行记录。 ##### 3. Oracle SQL 的高级特性 - **分区**:通过将大表或索引分解成较小的、更易管理的部分来提高查询性能。 - *...
这包括了解SQL(结构化查询语言)的基本语法,如SELECT语句用于查询数据,INSERT语句用于插入新记录,UPDATE语句用于修改现有记录,以及DELETE语句用于删除记录。此外,还会介绍如何使用FROM子句指定数据源,WHERE...
Oracle SQL 判断值为空OrNull 判断 Oracle SQL 中判断值为空或 Null 的方法有多种,在本文中,我们将介绍 Oracle 和 SQL Server 中的空值判断方法。 Oracle 中的空值判断 在 Oracle 中,可以使用 `NVL` 函数来...
Oracle SQL和PL/SQL是两种在Oracle数据库管理系统中广泛使用的编程语言,它们在数据库管理和开发领域扮演着核心角色。Oracle SQL是SQL标准的一个实现,主要用于查询、操作和管理Oracle数据库中的数据,而PL/SQL是一...
SQL 语句优化的过程包括定位有问题的语句、检查执行计划、检查执行过程中优化器的统计信息、分析相关表的记录数、索引情况、改写 SQL 语句、使用 HINT、调整索引、表分析等。只有通过这种方式,才能达到最佳执行...
Oracle SQL语法大全 Oracle SQL语法大全是关系数据库标准语言SQL的详细介绍,涵盖了SQL的基础知识、语法结构、数据类型、查询语句、操作符的使用等方面的内容。 SQL基础知识 SQL(Structured Query Language)是...
本文档涵盖了 Oracle SQL 语法的主要部分,包括数据记录筛选、更新数据记录、删除数据记录、添加数据记录、数据记录统计函数、数据表的建立和删除、记录集对象的方法等。 一、数据记录筛选 数据记录筛选是指从数据...