a.single table insert

INSERT INTO jobs(job_id,job_title,min_salary,Max_Salary)
VALUES('IT_PM','PROJECT MANAGER',5000,11000);

INSERT INTO scott.bonus(ename,job,sal,comm)
SELECT ename,job,sal*.10
FROM scott.emp;

 b.more table insert

create table small_table(
customer_id number,
sum_orders number
);
create table medium_table(
customer_id number,
sum_orders number
);
create table larger_table(
customer_id number,
sum_orders number
);
INSERT ALL
WHEN sum_orders<1000 THEN
INTO small_table
WHEN sum_orders>=1000 AND sum_orders<1000 THEN
INTO medium_table
ELSE
INTO larger_table
SELECT customer_id,SUM(order_total) sum_orders
FROM oe.orders
GROUP BY customer_id;

 

posted on 2017-11-27 21:35  杨杨yang  阅读(140)  评论(0编辑  收藏  举报