SQL/MX 2.x Reference Manual (H06.10+, J06.03+)
SQL/MX Statements
HP NonStop SQL/MX Reference Manual—544517-008
2-99
Examples of CREATE TABLE
NOT DROPPABLE
)
LOCATION \CARNAG.$SARA.ZSDCL87P.H5V45W00
NAME CARNAG_SARA_ZSDCL87P_H5V45W00
ATTRIBUTES EXTENT (1024, 1024), MAXEXTENTS 16
PARTITION
(
ADD FIRST KEY (2)
LOCATION \CARNAG.$HIJO.ZSDCL87P.PT245W00
NAME CARNAG_HIJO_ZSDCL87P_PT245W00
EXTENT (1024, 1024) MAXEXTENTS 16
, ADD FIRST KEY (512)
LOCATION \CARNAG.$CHINA.ZSDCL87P.S1645W00
NAME CARNAG_CHINA_ZSDCL87P_S1645W00
EXTENT (1024, 1024) MAXEXTENTS 16
)
STORE BY (A ASC)
;
--- SQL operation complete.
>>
•
This example creates table mytable with hash partitions.
create table mytable
( col1 timestamp default current_timestamp not null
, col2 int not null
, col3 varchar (30)
, col4 smallint not null
, primary key (col4, col1) )
location $VOL1
hash partition by (col4)
( add location $VOL2
, add location $VOL3
, add location $VOL4)
attribute
extent (1024, 1024),
maxextents 16
;
create unique index mytable_idx1 on mytable(col2, col1)
LOCATION $vol1
hash partition by (col2)
( add location $VOL2
, add location $VOL3
, add location $VOL4
, add location $VOL5)
;
•
This example creates a table stored by primary key. These defaults are in effect:
POS_LOCATIONS is set to $VOL1, $VOL2, $VOL3 and POS_NUM_OF_PARTNS is
set to 3.
CREATE TABLE SALES.ODETAIL
( ordernum NUMERIC (6) UNSIGNED NO DEFAULT NOT NULL,
partnum NUMERIC (4) UNSIGNED NO DEFAULT NOT NULL,










