SQL> Create table small_orders(order_id number(12) not null,
customer_id number(6) not null,
order_total number(8,2),
sales_rep_id number(6)
);
SQL> Creat table medium_orders as select * from small_orders;
SQL> Creat table large_orders as select * from small_orders;
SQL>Create table special_orders(order id number(12) not null,
customer_id number(6),
order_total number(8,2),
sales_rep_id number(6),
credit_limit number(9,2),
cust_email varchar2(30)
);
Insert all
when ottl < 10000 then
into small_orders
when ottl > 10000 and ottl < 20000 then
into medium_orders
when ottl> 20000 then
into large_orders
when ottl>29000 then
into special_orders
select o.order_id oid, o.customer_id cid, o.order_total ottl,
o.sales_rep_id sid, c.credit_limit cl, c.cust_email cem
from orders o, customers
where o.customer_id = c.customer_id;