数据仓库服务 GAUSSDB(DWS)-Unique Index:Unique Index

时间:2024-10-26 11:41:20

Unique Index

Netezza语法

迁移后语法

 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
CREATE TABLE  prod
(
     prod_no              number(6)      not null    unique,
     prod_name         national character varying(32)      not null,
     prod_desc          clob
)
DISTRIBUTE ON (prod_no)
ORGANIZE   ON (prod_no, prod_name)
;
----------
CREATE TABLE  prod
(
     prod_no              number(6)      not null     
     CONSTRAINT UQ_prod unique,
     prod_name         national character varying(32)      not null,
     prod_desc          clob
)
DISTRIBUTE ON (prod_no)
ORGANIZE   ON (prod_no, prod_name)
;
----------
CREATE TABLE  prod
(
     prod_no              number(6)      not null    PRIMARY KEY,
     prod_name         national character varying(32)      not null,
     prod_desc          clob
)
DISTRIBUTE ON (prod_no)
ORGANIZE   ON (prod_no, prod_name)
;
----------
CREATE TABLE  prod
(
     prod_no              number(6)      not null,
     prod_name         national character varying(32)      not null,
     prod_desc          clob,
     constraint          uq_prod    UNIQUE (prod_no)
)
DISTRIBUTE ON (prod_no)
ORGANIZE   ON (prod_no, prod_name)
;
----------
CREATE TABLE  prod
(
     prod_no              number(6)      not null,
     prod_name         national character varying(32)      not null,
     prod_desc          clob
)
DISTRIBUTE ON (prod_no)
ORGANIZE   ON (prod_no, prod_name)
;
ALTER TABLE prod
    ADD constraint          uq_prod    UNIQUE (prod_no);
 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
CREATE TABLE  prod
(
     prod_no              number(6)      not null   /* unique */,
     prod_name         national character varying(32)      not null,
     prod_desc          clob
) WITH(ORIENTATION=COLUMN)
DISTRIBUTE BY HASH (prod_no)
/* ORGANIZE   ON (prod_no, prod_name) */
;
----------
CREATE TABLE  prod
(
     prod_no              number(6)      not null   
  /* CONSTRAINT UQ_prod unique */,
     prod_name         national character varying(32)      not null,
     prod_desc          clob
) WITH(ORIENTATION=COLUMN)
DISTRIBUTE BY HASH (prod_no)
/* ORGANIZE   ON (prod_no, prod_name) */
;
----------
CREATE TABLE  prod
(
     prod_no              number(6)      not null   /* PRIMARY KEY */,
     prod_name         national character varying(32)      not null,
     prod_desc          clob
) WITH(ORIENTATION=COLUMN)
DISTRIBUTE BY HASH (prod_no)
/* ORGANIZE   ON (prod_no, prod_name) */
;
----------
CREATE TABLE  prod
(
     prod_no              number(6)      not null,
     prod_name         national character varying(32)      not null,
     prod_desc          clob  /*,
    constraint          uq_prod    UNIQUE (prod_no)  */
) WITH(ORIENTATION=COLUMN)
DISTRIBUTE BY HASH (prod_no)
/* ORGANIZE   ON (prod_no, prod_name)*/
;
----------
CREATE TABLE  prod
(
     prod_no              number(6)      not null,
     prod_name         national character varying(32)      not null,
     prod_desc          clob
)
DISTRIBUTE BY HASH (prod_no)
/*ORGANIZE   ON (prod_no, prod_name)*/
;
/*
ALTER TABLE prod
    ADD constraint          uq_prod    UNIQUE (prod_no);
*/

仅适用于COLUMN store。对于ROW存储,不应注释“唯一索引”。

support.huaweicloud.com/tg-dws/dws_07_6827.html