D. Create Ordered Table Statements
 
Share this page                  
Create Ordered Table Statements
Change 'NN' to the required number of partitions as described in Partitioning Tables and Configuring Database Resources.
create table customer2 as
select *
from
customer
order by
c_custkey;
alter table customer2 add primary key(c_custkey);
 
create table lineitem2 as
select *
from
lineitem
order by
l_orderkey
with partition = (hash on l_orderkey NN partitions);
 
create table nation2 as
select *
from
nation
order by
n_nationkey;
alter table nation2 add primary key(n_nationkey);
 
create table orders2 as
select *
from
orders
order by
o_orderdate
with partition = (hash on o_orderkey NN partitions);
alter table orders2 add primary key(o_orderkey);
 
create table partsupp2 as
select *
from
partsupp
order by
ps_partkey
with partition = (hash on ps_partkey, ps_suppkey NN partitions);
alter table partsupp2 add primary key(ps_partkey, ps_suppkey);
 
create table part2 as
select *
from
part
order by
p_partkey;
alter table part2 add primary key(p_partkey);
 
create table region2 as
select *
from
region
order by
r_regionkey;
alter table region2 add primary key(r_regionkey);
 
create table supplier2 as
select *
from
supplier
order by
s_suppkey;
alter table supplier2 add primary key(s_suppkey);