首页 > 其他 > 详细

ocp 试题学习中 _转子查询返回的数据行是如何用来插入多个表中

时间:2014-03-19 06:18:47      阅读:343      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
http://www.itpub.net/thread-1802215-1-1.html  转


多表插入――有条件的insert all [复制链接] 子查询返回的数据行是如何用来插入多个表中 small_customers medium_customers large_customers create table small_customers(customer_id number,sum_orders number); create table medium_customers(customer_id number,sum_orders number); create table large_customers(customer_id number,sum_orders number); create table orders(customer_id number,order_total number); insert into orders values(
1,200); insert into orders values(1,400); insert into orders values(2,50000); insert into orders values(2,80000); insert into orders values(3,200000); insert into orders values(3,2000); insert all when sum_orders < 10000 then into small_customers when sum_orders >= 10000 and sum_orders < 200000 then into medium_customers else into large_customers select customer_id,sum(order_total) sum_orders from orders group by customer_id; commit; SQL> select * from small_customers; CUSTOMER_ID SUM_ORDERS ----------- ---------- 1 600 SQL> select * from medium_customers; CUSTOMER_ID SUM_ORDERS ----------- ---------- 2 130000 SQL> select * from large_customers; CUSTOMER_ID SUM_ORDERS ----------- ---------- 3 202000
bubuko.com,布布扣

ocp 试题学习中 _转子查询返回的数据行是如何用来插入多个表中,布布扣,bubuko.com

ocp 试题学习中 _转子查询返回的数据行是如何用来插入多个表中

原文:http://www.cnblogs.com/kaka100/p/3608547.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!