Este tutorial es una continuación de los tutoriales anteriores. Se supone que ha creado «TPCH
”Usuario con los permisos y firmas adecuados en su sistema en Studio con el usuario. I Consola de administración de SAP HANA perspectiva, haga clic con el botón derecho en el enlace de su sistema firmado al «TPCH
«Usuario (formato: <SID> (TPCH)
) y seleccione Abrir consola SQL.
Copie y pegue el siguiente script en la consola SQL, luego haga clic en el botón Ejecutar para crear tablas de repositorio de columnas de memoria. También puedes empujar F8.
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 luego haga clic en el botón Ejecutar para crear las tablas de Capa dinámica. También puedes empujar F8.
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;
Nuevamente, verifique que todo esté hecho correctamente.
Sa Sistemas vista izquierda, expandir a Catalogar > TPCH > Mesas. Haga clic derecho en la tabla y seleccione Renovación. También puedes empujar F5.
Una vez que Studio termine de actualizarse, debería ver las tablas que se enumeran a continuación en Mesas carpeta. Las tablas «dinámicas» mostrarán «ADICIÓN» después del nombre de la tabla (sufijo «GP») y las tablas de almacenamiento de columnas de memoria (sufijo «CS») no se mostrarán.
[ACCORDION-BEGIN [Step 2: ](Explicación del guión)]
La principal diferencia de sintaxis al crear una tabla de capa dinámica es la adición de la cláusula «USE ADDITIONAL STORAGE» a la declaración «CREATE TABLE» como se muestra en la siguiente imagen. También puede tener en cuenta que no se indica explícitamente que las tablas de capa dinámica deben ser tablas «COLUMN». Todas las tablas de capa dinámica se almacenan como tablas en columnas, por lo que el uso de “CREAR TABLA DE COLUMNA” frente a “CREAR TABLA” es opcional.