数据仓库服务 GAUSSDB(DWS)-建表与导入SSB数据:创建SSB目标表
时间:2024-10-22 11:41:47
创建SSB目标表
连接DWS数据库后执行以下SQL语句。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
CREATE TABLE CUSTOMER ( C_CUSTKEY BIGINT NOT NULL, C_NAME VARCHAR(25) NOT NULL, C_ADDRESS VARCHAR(40) NOT NULL, C_CITY VARCHAR(25) NOT NULL, C_NATION VARCHAR(25) NOT NULL, C_REGION VARCHAR(25) NOT NULL, C_PHONE VARCHAR(15) NOT NULL, C_MKTSEGMENT VARCHAR(10) NOT NULL ) WITH (orientation=column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash(C_CUSTKEY) ; CREATE TABLE SUPPLIER ( S_SUPPKEY BIGINT NOT NULL , S_NAME VARCHAR(25) NOT NULL , S_ADDRESS VARCHAR(40) NOT NULL , S_CITY VARCHAR(25) NOT NULL , S_NATION VARCHAR(25) NOT NULL , S_REGION VARCHAR(25) NOT NULL , S_PHONE VARCHAR(15) NOT NULL ) WITH (orientation=column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash(S_SUPPKEY); CREATE TABLE PART ( P_PARTKEY BIGINT NOT NULL , P_NAME VARCHAR(55) NOT NULL , P_MFGR VARCHAR(25) NOT NULL , P_CATEGORY VARCHAR(25) NOT NULL , P_BRAND VARCHAR(10) NOT NULL , P_COLOR VARCHAR(20) NOT NULL , P_TYPE VARCHAR(25) NOT NULL , P_SIZE BIGINT NOT NULL , P_CONTAINER VARCHAR(10) NOT NULL ) WITH (orientation=column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash(P_PARTKEY); CREATE TABLE lineorder ( LO_ORDERKEY BIGINT NOT NULL, LO_LINENUMBER BIGINT NOT NULL, LO_CUSTKEY BIGINT NOT NULL, LO_PARTKEY BIGINT NOT NULL, LO_SUPPKEY BIGINT NOT NULL, LO_ORDERDATE DATE NOT NULL, LO_ORDERPRIORITY VARCHAR(15) NOT NULL, LO_SHIPPRIORITY BIGINT NOT NULL, LO_QUANTITY BIGINT NOT NULL, LO_EXTENDEDPRICE BIGINT NOT NULL, LO_ORDTOTALPRICE BIGINT NOT NULL, LO_DISCOUNT BIGINT NOT NULL, LO_REVENUE BIGINT NOT NULL, LO_SUPPLYCOST BIGINT NOT NULL, LO_TAX BIGINT NOT NULL, LO_COMMITDATE DATE NOT NULL, LO_SHIPMODE VARCHAR(10) NOT NULL ) WITH (orientation=column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash(LO_ORDERKEY) PARTITION BY RANGE(LO_ORDERDATE) ( PARTITION LO_ORDERDATE_1 VALUES LESS THAN('1992-04-01 00:00:00'), PARTITION LO_ORDERDATE_2 VALUES LESS THAN('1992-07-01 00:00:00'), PARTITION LO_ORDERDATE_3 VALUES LESS THAN('1992-10-01 00:00:00'), PARTITION LO_ORDERDATE_4 VALUES LESS THAN('1993-01-01 00:00:00'), PARTITION LO_ORDERDATE_5 VALUES LESS THAN('1993-04-01 00:00:00'), PARTITION LO_ORDERDATE_6 VALUES LESS THAN('1993-07-01 00:00:00'), PARTITION LO_ORDERDATE_7 VALUES LESS THAN('1993-10-01 00:00:00'), PARTITION LO_ORDERDATE_8 VALUES LESS THAN('1994-01-01 00:00:00'), PARTITION LO_ORDERDATE_9 VALUES LESS THAN('1994-04-01 00:00:00'), PARTITION LO_ORDERDATE_10 VALUES LESS THAN('1994-07-01 00:00:00'), PARTITION LO_ORDERDATE_11 VALUES LESS THAN('1994-10-01 00:00:00'), PARTITION LO_ORDERDATE_12 VALUES LESS THAN('1995-01-01 00:00:00'), PARTITION LO_ORDERDATE_13 VALUES LESS THAN('1995-04-01 00:00:00'), PARTITION LO_ORDERDATE_14 VALUES LESS THAN('1995-07-01 00:00:00'), PARTITION LO_ORDERDATE_15 VALUES LESS THAN('1995-10-01 00:00:00'), PARTITION LO_ORDERDATE_16 VALUES LESS THAN('1996-01-01 00:00:00'), PARTITION LO_ORDERDATE_17 VALUES LESS THAN('1996-04-01 00:00:00'), PARTITION LO_ORDERDATE_18 VALUES LESS THAN('1996-07-01 00:00:00'), PARTITION LO_ORDERDATE_19 VALUES LESS THAN('1996-10-01 00:00:00'), PARTITION LO_ORDERDATE_20 VALUES LESS THAN('1997-01-01 00:00:00'), PARTITION LO_ORDERDATE_21 VALUES LESS THAN('1997-04-01 00:00:00'), PARTITION LO_ORDERDATE_22 VALUES LESS THAN('1997-07-01 00:00:00'), PARTITION LO_ORDERDATE_23 VALUES LESS THAN('1997-10-01 00:00:00'), PARTITION LO_ORDERDATE_24 VALUES LESS THAN('1998-01-01 00:00:00'), PARTITION LO_ORDERDATE_25 VALUES LESS THAN('1998-04-01 00:00:00'), PARTITION LO_ORDERDATE_26 VALUES LESS THAN('1998-07-01 00:00:00'), PARTITION LO_ORDERDATE_27 VALUES LESS THAN('1998-10-01 00:00:00'), PARTITION LO_ORDERDATE_28 VALUES LESS THAN('1999-01-01 00:00:00') ); SET enable_hstoreopt_auto_bitmap=true; CREATE TABLE lineorder_flat ( LO_ORDERKEY BIGINT NOT NULL, LO_LINENUMBER BIGINT NOT NULL, LO_CUSTKEY BIGINT NOT NULL, LO_PARTKEY BIGINT NOT NULL, LO_SUPPKEY BIGINT NOT NULL, LO_ORDERDATE DATE NOT NULL, LO_ORDERPRIORITY VARCHAR(15) NOT NULL, LO_SHIPPRIORITY BIGINT NOT NULL, LO_QUANTITY BIGINT NOT NULL, LO_EXTENDEDPRICE BIGINT NOT NULL, LO_ORDTOTALPRICE BIGINT NOT NULL, LO_DISCOUNT BIGINT NOT NULL, LO_REVENUE BIGINT NOT NULL, LO_SUPPLYCOST BIGINT NOT NULL, LO_TAX BIGINT NOT NULL, LO_COMMITDATE DATE NOT NULL, LO_SHIPMODE VARCHAR(10) NOT NULL, C_NAME VARCHAR(25) NOT NULL , C_ADDRESS VARCHAR(40) NOT NULL , C_CITY VARCHAR(25) NOT NULL , C_NATION VARCHAR(25) NOT NULL , C_REGION VARCHAR(25) NOT NULL , C_PHONE VARCHAR(15) NOT NULL , C_MKTSEGMENT VARCHAR(10) NOT NULL , S_NAME VARCHAR(25) NOT NULL , S_ADDRESS VARCHAR(40) NOT NULL , S_CITY VARCHAR(25) NOT NULL , S_NATION VARCHAR(25) NOT NULL , S_REGION VARCHAR(25) NOT NULL , S_PHONE VARCHAR(15) NOT NULL , P_NAME VARCHAR(55) NOT NULL , P_MFGR VARCHAR(25) NOT NULL , P_CATEGORY VARCHAR(25) NOT NULL , P_BRAND VARCHAR(10) NOT NULL , P_COLOR VARCHAR(20) NOT NULL , P_TYPE VARCHAR(25) NOT NULL , P_SIZE BIGINT NOT NULL , P_CONTAINER VARCHAR(10) NOT NULL , Partial Cluster Key(s_region,s_nation,s_city) ) WITH (orientation=column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true,secondary_part_column='p_mfgr', secondary_part_num=8) DISTRIBUTE BY hash(LO_ORDERKEY) PARTITION BY RANGE(LO_ORDERDATE) ( PARTITION LO_ORDERDATE_1 VALUES LESS THAN('1992-04-01 00:00:00'), PARTITION LO_ORDERDATE_2 VALUES LESS THAN('1992-07-01 00:00:00'), PARTITION LO_ORDERDATE_3 VALUES LESS THAN('1992-10-01 00:00:00'), PARTITION LO_ORDERDATE_4 VALUES LESS THAN('1993-01-01 00:00:00'), PARTITION LO_ORDERDATE_5 VALUES LESS THAN('1993-04-01 00:00:00'), PARTITION LO_ORDERDATE_6 VALUES LESS THAN('1993-07-01 00:00:00'), PARTITION LO_ORDERDATE_7 VALUES LESS THAN('1993-10-01 00:00:00'), PARTITION LO_ORDERDATE_8 VALUES LESS THAN('1994-01-01 00:00:00'), PARTITION LO_ORDERDATE_9 VALUES LESS THAN('1994-04-01 00:00:00'), PARTITION LO_ORDERDATE_10 VALUES LESS THAN('1994-07-01 00:00:00'), PARTITION LO_ORDERDATE_11 VALUES LESS THAN('1994-10-01 00:00:00'), PARTITION LO_ORDERDATE_12 VALUES LESS THAN('1995-01-01 00:00:00'), PARTITION LO_ORDERDATE_13 VALUES LESS THAN('1995-04-01 00:00:00'), PARTITION LO_ORDERDATE_14 VALUES LESS THAN('1995-07-01 00:00:00'), PARTITION LO_ORDERDATE_15 VALUES LESS THAN('1995-10-01 00:00:00'), PARTITION LO_ORDERDATE_16 VALUES LESS THAN('1996-01-01 00:00:00'), PARTITION LO_ORDERDATE_17 VALUES LESS THAN('1996-04-01 00:00:00'), PARTITION LO_ORDERDATE_18 VALUES LESS THAN('1996-07-01 00:00:00'), PARTITION LO_ORDERDATE_19 VALUES LESS THAN('1996-10-01 00:00:00'), PARTITION LO_ORDERDATE_20 VALUES LESS THAN('1997-01-01 00:00:00'), PARTITION LO_ORDERDATE_21 VALUES LESS THAN('1997-04-01 00:00:00'), PARTITION LO_ORDERDATE_22 VALUES LESS THAN('1997-07-01 00:00:00'), PARTITION LO_ORDERDATE_23 VALUES LESS THAN('1997-10-01 00:00:00'), PARTITION LO_ORDERDATE_24 VALUES LESS THAN('1998-01-01 00:00:00'), PARTITION LO_ORDERDATE_25 VALUES LESS THAN('1998-04-01 00:00:00'), PARTITION LO_ORDERDATE_26 VALUES LESS THAN('1998-07-01 00:00:00'), PARTITION LO_ORDERDATE_27 VALUES LESS THAN('1998-10-01 00:00:00'), PARTITION LO_ORDERDATE_28 VALUES LESS THAN('1999-01-01 00:00:00') ) ; SET enable_hstoreopt_auto_bitmap=false; |
support.huaweicloud.com/pwp-910-dws/dws_13_00029.html
看了此文的人还看了
CDN加速
GaussDB
文字转换成语音
免费的服务器
如何创建网站
域名网站购买
私有云桌面
云主机哪个好
域名怎么备案
手机云电脑
SSL证书申请
云点播服务器
免费OCR是什么
电脑云桌面
域名备案怎么弄
语音转文字
文字图片识别
云桌面是什么
网址安全检测
网站建设搭建
国外CDN加速
SSL免费证书申请
短信批量发送
图片OCR识别
云数据库MySQL
个人域名购买
录音转文字
扫描图片识别文字
OCR图片识别
行驶证识别
虚拟电话号码
电话呼叫中心软件
怎么制作一个网站
Email注册网站
华为VNC
图像文字识别
企业网站制作
个人网站搭建
华为云计算
免费租用云托管
云桌面云服务器
ocr文字识别免费版
HTTPS证书申请
图片文字识别转换
国外域名注册商
使用免费虚拟主机
云电脑主机多少钱
鲲鹏云手机
短信验证码平台
OCR图片文字识别
SSL证书是什么
申请企业邮箱步骤
免费的企业用邮箱
云免流搭建教程
域名价格
推荐文章
- 数据仓库服务GaussDB(DWS)_SQL on Anywhere
- GaussDB(DWS)常用SQL_常用SQL命令_SQL语法
- DWS安全_数据仓库服务安全_DWS数据安全管理_DWS安全保障_DWS安全策略
- GAUSS(DWS)工具_gsql工具_DataStudio工具_DSC工具
- DWS产品介绍_DWS产品优势_DWS功能_DWS使用场景_DWS是什么
- 调用GaussDB(DWS) API接口_数据仓库服务调用API_如何调用API_在DWS中调用API
- GaussDB查询库表_GaussDB查询数据库表_高斯数据库查询库表-华为云
- GaussDB查看表大小_GaussDB查询表空间_高斯数据库查看表大小-华为云
- GaussDB MPP_高斯数据库查看建表语句_高斯数据库 MPP_华为云
- GaussDB查询表结构_通配符字段查询表_高斯数据库查询表结构-华为云