oracle 笔记 II 之DML:数据操作语言
DML:Data Manipulation Language 数据操作语言
包括:CRUD
1. insert语句
(1) 从其它表中复制数据,实现方法:在insert 语句中加入查询语句
insert into sales_reps(id,name,salary,commission_pct) select employee_id,last_name,salary,commission_pct
from employees where job_id like '%rep';
(2) update中使用子查询
update employees set job_id = (select job_id from employees where employee_id = 205),
salary = (select salary from employees where employee_id = 205)
where employee_id = 114;
如:更新114号员工的工作和工资使其与205号员工相同
update employees set job_id = (select job_id from employees where employee_id = 205),
salary = (select salary from employees where employee_id = 205)
where employee_id = 114
再看一个问题,仔细体会解决步骤:
更改 108 员工的信息: 使其 工资变为所在部门中的最高工资,job变为公司中平均工资最低的job
分析:
第1 步 首先查询 108 所在部门的最高工资是多少
select max(salary) from employees where department_id =
( select department_id from employees where employee_id = 108)
第 2 步 查询公司中平均工资最低的 job_id
select job_id from employees group by job_id having avg(salary) =
(select min(avg_sal) from(select avg(salary) avg_sal from employees group by job_id) )
第 3 步 实现更新
update employees set salary = ( select max(salary) from employees
where department_id =
相关文档:
oracle表空间操作详解
1
2
3作者: 来源: 更新日期:2006-01-04
5
6
7建立表空间
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
Imp和Exp
命令详解:
Exp
导出
模式:
Full模式---导出
整个数据库
User模式---导出
指定的用户
Table模式—导出
指定的表
Tablespace模式—导出
表
空间
Exp
导出
参数:
OWNER指定要导出
的用户列表
FULL=y表示要导出
整个数据库
Tables指定要导出
的表
Tablepaces指定要导出
的表
......
一、设置初始化参数 job_queue_processes
sql> alter system set job_queue_processes=n;(n>0)
job_queue_processes最大值为1000
查看job queue 后台进程
sql>select name,description from v$bgprocess;
二,dbms_job package 用法介绍
包含以下子过程:
......
在PL/SQL程序设计中,有三种定义记录类型的方法:一种是使用%ROWTYPE属性;另一种是在PL/SQL程序的声明部分显示定义记录类型;最后一种方法是将记录类型定义为数据库结构或对象类型。
我先简单的介绍一个下面要用到的表的结构(黑体标明的字段为主键):
INDIVIDUALS表
INDIVIDUAL ID
FIRST NAME
MIDDLE_INITI ......
导读:
2009年9月Oracle公司发布了期待已久的Oracle 11g R2,本系列文章将给读者一一揭开新版本中的新特性,并会介绍企业如何利用这些新特性将现有的Oracle 9i,10g,11g R1升级到Oracle 11g R2.
经历了难以忍受的长时间等待,Oracle公司突然在9月1发布了Oracle 11g R2,我不得不承认Oracle的保密工作做得 ......