Los tutoriales anteriores son una continuación de los tutoriales anteriores. Se asume que ha creado un TPCH
usuario con los permisos correctos e iniciado sesión en la base de datos utilizando este usuario. En Web IDE, haga clic con el botón derecho en la base de datos (debe estar etiquetada <Tenant>@Host(TPCH)
) y seleccione Abrir consola SQL. También puedes usar el atajo Ctrl + Alt + C..
Copie y pegue el siguiente script en la consola SQL y ejecute el script con el botón verde de reproducción. Este script creará las tablas de almacenamiento de columnas en la memoria.
CREATE COLUMN TABLE "TPCH"."CUSTOMER_CS" (
C_CUSTKEY integer not null,
C_NAME varchar(25) not null,
C_ADDRESS varchar(40) not null,
C_NATIONKEY integer not null,
C_PHONE char(15) not null,
C_ACCTBAL decimal(15,2) not null,
C_MKTSEGMENT char(10) not null,
C_COMMENT varchar(117) not null,
primary key (C_CUSTKEY)
);
CREATE COLUMN TABLE "TPCH"."LINEITEM_CS" (
L_ORDERKEY integer not null,
L_PARTKEY integer not null,
L_SUPPKEY integer not null,
L_LINENUMBER integer not null,
L_QUANTITY decimal(15,2) not null,
L_EXTENDEDPRICE decimal(15,2) not null,
L_DISCOUNT decimal(15,2) not null,
L_TAX decimal(15,2) not null,
L_RETURNFLAG char not null,
L_LINESTATUS char not null,
L_SHIPDATE date not null,
L_COMMITDATE date not null,
L_RECEIPTDATE date not null,
L_SHIPINSTRUCT char(25) not null,
L_SHIPMODE char(10) not null,
L_COMMENT varchar(44) not null,
primary key (L_ORDERKEY, L_LINENUMBER)
);
CREATE COLUMN TABLE "TPCH"."NATION_CS" (
N_NATIONKEY integer not null,
N_NAME char(25) not null,
N_REGIONKEY integer not null,
N_COMMENT varchar(152) not null,
primary key (N_NATIONKEY)
);
CREATE COLUMN TABLE "TPCH"."ORDERS_CS" (
O_ORDERKEY integer not null,
O_CUSTKEY integer not null,
O_ORDERSTATUS char not null,
O_TOTALPRICE decimal(15,2) not null,
O_ORDERDATE date not null,
O_ORDERPRIORITY char(15) not null,
O_CLERK char(15) not null,
O_SHIPPRIORITY integer not null,
O_COMMENT varchar(79) not null,
primary key (O_ORDERKEY)
);
CREATE COLUMN TABLE "TPCH"."PART_CS" (
P_PARTKEY integer not null,
P_NAME varchar(55) not null,
P_MFGR char(25) not null,
P_BRAND char(10) not null,
P_TYPE varchar(25) not null,
P_SIZE integer not null,
P_CONTAINER char(10) not null,
P_RETAILPRICE decimal(15,2) not null,
P_COMMENT varchar(23) not null,
primary key (P_PARTKEY)
);
CREATE COLUMN TABLE "TPCH"."PARTSUPP_CS" (
PS_PARTKEY integer not null,
PS_SUPPKEY integer not null,
PS_AVAILQTY integer not null,
PS_SUPPLYCOST decimal(15,2) not null,
PS_COMMENT varchar(199) not null,
primary key (PS_PARTKEY, PS_SUPPKEY)
);
CREATE COLUMN TABLE "TPCH"."REGION_CS" (
R_REGIONKEY integer not null,
R_NAME char(25) not null,
R_COMMENT varchar(152) not null,
primary key (R_REGIONKEY)
);
CREATE COLUMN TABLE "TPCH"."SUPPLIER_CS" (
S_SUPPKEY integer not null,
S_NAME char(25) not null,
S_ADDRESS varchar(40) not null,
S_NATIONKEY integer not null,
S_PHONE char(15) not null,
S_ACCTBAL decimal(15,2) not null,
S_COMMENT varchar(101) not null,
primary key (S_SUPPKEY)
);
ALTER TABLE "TPCH"."CUSTOMER_CS"
ADD CONSTRAINT FK_CUSTOMER_REFERENCE_NATION_CS FOREIGN KEY(C_NATIONKEY)
REFERENCES "TPCH"."NATION_CS" (N_NATIONKEY)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE "TPCH"."LINEITEM_CS"
ADD CONSTRAINT FK_LINEITEM_REFERENCE_ORDERS_CS FOREIGN KEY(L_ORDERKEY)
REFERENCES "TPCH"."ORDERS_CS" (O_ORDERKEY)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE "TPCH"."LINEITEM_CS"
ADD CONSTRAINT FK_LINEITEM_REFERENCE_PART_CS FOREIGN KEY(L_PARTKEY)
REFERENCES "TPCH"."PART_CS" (P_PARTKEY)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE "TPCH"."LINEITEM_CS"
ADD CONSTRAINT FK_LINEITEM_REFERENCE_SUPPLIER_CS FOREIGN KEY (L_SUPPKEY)
REFERENCES "TPCH"."SUPPLIER_CS" (S_SUPPKEY)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE "TPCH"."NATION_CS"
ADD CONSTRAINT FK_NATION_REFERENCE_REGION_CS FOREIGN KEY (N_REGIONKEY)
REFERENCES "TPCH"."REGION_CS" (R_REGIONKEY)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE "TPCH"."ORDERS_CS"
ADD CONSTRAINT FK_ORDERS_REFERENCE_CUSTOMER_CS FOREIGN KEY (O_CUSTKEY)
REFERENCES "TPCH"."CUSTOMER_CS" (C_CUSTKEY)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE "TPCH"."PARTSUPP_CS"
ADD CONSTRAINT FK_PARTSUPP_REFERENCE_PART_CS FOREIGN KEY (PS_PARTKEY)
REFERENCES "TPCH"."PART_CS" (P_PARTKEY)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE "TPCH"."PARTSUPP_CS"
ADD CONSTRAINT FK_PARTSUPP_REFERENCE_SUPPLIER_CS FOREIGN KEY (PS_SUPPKEY)
REFERENCES "TPCH"."SUPPLIER_CS" (S_SUPPKEY)
ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE "TPCH"."SUPPLIER_CS"
ADD CONSTRAINT FK_SUPPLIER_REFERENCE_NATION_CS FOREIGN KEY (S_NATIONKEY)
REFERENCES "TPCH"."NATION_CS" (N_NATIONKEY)
ON DELETE RESTRICT ON UPDATE RESTRICT;
Confirma que todo salió bien sin errores.
Ahora reemplace el código a continuación en el código en la consola SQL y ejecute el script usando el Carrera botón. Esto creará las tablas seriales dinámicas. Nuevamente, verifique que todo se ejecutó sin errores.
CREATE TABLE "TPCH"."CUSTOMER_DT" (
C_CUSTKEY integer not null,
C_NAME varchar(25) not null,
C_ADDRESS varchar(40) not null,
C_NATIONKEY integer not null,
C_PHONE char(15) not null,
C_ACCTBAL decimal(15,2) not null,
C_MKTSEGMENT char(10) not null,
C_COMMENT varchar(117) not null,
primary key (C_CUSTKEY)
) USING EXTENDED STORAGE;
CREATE TABLE "TPCH"."LINEITEM_DT" (
L_ORDERKEY integer not null,
L_PARTKEY integer not null,
L_SUPPKEY integer not null,
L_LINENUMBER integer not null,
L_QUANTITY decimal(15,2) not null,
L_EXTENDEDPRICE decimal(15,2) not null,
L_DISCOUNT decimal(15,2) not null,
L_TAX decimal(15,2) not null,
L_RETURNFLAG char not null,
L_LINESTATUS char not null,
L_SHIPDATE date not null,
L_COMMITDATE date not null,
L_RECEIPTDATE date not null,
L_SHIPINSTRUCT char(25) not null,
L_SHIPMODE char(10) not null,
L_COMMENT varchar(44) not null,
primary key (L_ORDERKEY, L_LINENUMBER)
) USING EXTENDED STORAGE;
CREATE TABLE "TPCH"."NATION_DT" (
N_NATIONKEY integer not null,
N_NAME char(25) not null,
N_REGIONKEY integer not null,
N_COMMENT varchar(152) not null,
primary key (N_NATIONKEY)
) USING EXTENDED STORAGE;
CREATE TABLE "TPCH"."ORDERS_DT" (
O_ORDERKEY integer not null,
O_CUSTKEY integer not null,
O_ORDERSTATUS char not null,
O_TOTALPRICE decimal(15,2) not null,
O_ORDERDATE date not null,
O_ORDERPRIORITY char(15) not null,
O_CLERK char(15) not null,
O_SHIPPRIORITY integer not null,
O_COMMENT varchar(79) not null,
primary key (O_ORDERKEY)
) USING EXTENDED STORAGE;
CREATE TABLE "TPCH"."PART_DT" (
P_PARTKEY integer not null,
P_NAME varchar(55) not null,
P_MFGR char(25) not null,
P_BRAND char(10) not null,
P_TYPE varchar(25) not null,
P_SIZE integer not null,
P_CONTAINER char(10) not null,
P_RETAILPRICE decimal(15,2) not null,
P_COMMENT varchar(23) not null,
primary key (P_PARTKEY)
) USING EXTENDED STORAGE;
CREATE TABLE "TPCH"."PARTSUPP_DT" (
PS_PARTKEY integer not null,
PS_SUPPKEY integer not null,
PS_AVAILQTY integer not null,
PS_SUPPLYCOST decimal(15,2) not null,
PS_COMMENT varchar(199) not null,
primary key (PS_PARTKEY, PS_SUPPKEY)
) USING EXTENDED STORAGE;
CREATE TABLE "TPCH"."REGION_DT" (
R_REGIONKEY integer not null,
R_NAME char(25) not null,
R_COMMENT varchar(152) not null,
primary key (R_REGIONKEY)
) USING EXTENDED STORAGE;
CREATE TABLE "TPCH"."SUPPLIER_DT" (
S_SUPPKEY integer not null,
S_NAME char(25) not null,
S_ADDRESS varchar(40) not null,
S_NATIONKEY integer not null,
S_PHONE char(15) not null,
S_ACCTBAL decimal(15,2) not null,
S_COMMENT varchar(101) not null,
primary key (S_SUPPKEY)
) USING EXTENDED STORAGE;
Sa Explorador de bases de datos pestaña, extender a Catalogar > TPCH > Mesas. Clic derecho en Mesas y haga clic en Mostrar tablas.
Debería ver las tablas que creamos en la nueva ventana. Las tablas de serie dinámicas (sufijo «GP») son del tipo «ADICIÓN» debajo del Tipo de tabla columna.