DROP TABLE O_customer;
CREATE TABLE O_customer
(
	c_id		integer not null,
	c_first		nchar(16) NULL,
	c_last		nchar(16) NULL,
	c_street1	nchar(20) NULL,	
	c_street2	nchar(20) NULL,	
	c_city		nchar(20) NULL,	
	c_state		nchar(2) NULL,	
	c_country	nchar(10) NULL,	
	c_zip		nchar(9) NULL,	
	c_phone		nchar(16) NULL,
	c_contact	nchar(25) NULL,
	c_since		datetime NULL
)
ON O_CUST_GROUP;

CREATE UNIQUE clustered INDEX O_c_idx ON O_customer (c_id)
ON O_CUST_GROUP;


DROP TABLE O_orders;
CREATE TABLE O_orders
(
	o_id		integer not null,
	o_c_id		integer NULL,
	o_ol_cnt	integer NULL,
	o_discount	numeric(4,2) NULL,
	o_total		numeric(9,2) NULL,
	o_status	integer NULL,
	o_entry_date	datetime NULL,
	o_ship_date	datetime NULL
)
ON O_ORDS_GROUP;


CREATE UNIQUE clustered INDEX O_ords_idx ON O_orders (o_id)
ON O_ORDS_GROUP

CREATE INDEX O_oc_idx_c ON O_orders (o_c_id)
ON O_ORDS_GROUP;

DROP TABLE O_orderline;
CREATE TABLE O_orderline
(
	ol_id		integer not null,
	ol_o_id		integer  NULL,
	ol_i_id		nchar(15) NULL,
	ol_qty		integer NULL,
	ol_status	integer NULL,
	ol_ship_date	datetime NULL
)
ON O_ORDL_GROUP

CREATE UNIQUE clustered INDEX O_ordl_idx_c ON O_orderline (ol_o_id, ol_id)
ON O_ORDL_GROUP;


DROP TABLE O_item;
CREATE TABLE O_item
(
	i_id		nchar(15) not null,
	i_name		nchar(20) NULL,
	i_desc		nvarchar(100) NULL,
	i_price		numeric(9,2) NULL,
	i_discount	float NULL
)
ON O_ITEM_GROUP;

CREATE UNIQUE clustered INDEX O_i_idx ON O_item (i_id)
ON O_ITEM_GROUP;
