Oracle简单的SQL处理

--单表插入
insert into hr.job(job_id,job_title,min_salary) values('IT','Project Manager',50000);

insert into scott.bonus(ename,job,sal)select ename,job,sal*0.10 from scott.emp;

--多表插入

insert all when sum_orders<10000 then
into small_customers
when sum_orders>=10000 and sum_orders<100000 then
into medium_customers
else
into large_customers
select customers_id,sum(order_total) sum_orders
from oe.orders
group by customer_id;

--Update语句

--创建副表
create table scott.employees2 as select * from oe.employees;
--add a primary key
alter table employees2 add constraint emp2_emp_id_key primary key (employee_id);

posted @ 2017-06-27 15:37  Ziv_zhong  阅读(190)  评论(0)    收藏  举报