4. Creating a Database and Loading Data : Create a Table
 
Share this page                  
Create a Table
The CREATE TABLE statement by default creates a table with VECTORWISE storage.
In this example, we create the lineitem table from the DBT-3 benchmark.
To create the lineitem table
1. Connect to the database created in the previous procedure by issuing the sql command at the operating system prompt:
sql dbtest
The Terminal Monitor starts.
2. Enter the following SQL statement at the Terminal Monitor prompt:
CREATE TABLE lineitem (
        l_orderkey INTEGER NOT NULL,
        l_partkey INTEGER NOT NULL,
        l_suppkey INTEGER NOT NULL,
        l_linenumber INTEGER NOT NULL,
        l_quantity DECIMAL(2,0) NOT NULL,
        l_extendedprice DECIMAL(8,2) NOT NULL,
        l_discount DECIMAL(2,2) NOT NULL,
        l_tax DECIMAL(2,2) NOT NULL,
        l_returnflag CHAR(1) NOT NULL,
        l_linestatus CHAR(1) NOT NULL,
        l_shipdate ANSIDATE NOT NULL,
        l_commitdate ANSIDATE NOT NULL,
        l_receiptdate ANSIDATE NOT NULL,
        l_shipinstruct CHAR(25) NOT NULL,
        l_shipmode CHAR(10) NOT NULL,
        l_comment VARCHAR(44) NOT NULL)
WITH PARTITION = (HASH ON l_orderkey NN PARTITIONS)\g
In the WITH PARTITION clause, replace NN with the number of partitions for the table.
More information:
VectorH Partitioning Guidelines