云数据库 GAUSSDB(FOR MYSQL)-LIST-LIST:使用示例

时间:2024-04-29 19:22:24

使用示例

  • LIST-LIST类型的使用示例
    CREATE TABLE tbl_list_list
    (
        col1 INT,
        col2 INT,
        col3 varchar(20),
        col4 DATE
    )
    PARTITION BY LIST (col1)
    SUBPARTITION BY LIST (col2)
    (
      PARTITION p0 VALUES in (1, 2)(
        SUBPARTITION partno0 VALUES in (1, 2),
        SUBPARTITION partno1 VALUES in (3, 4),
        SUBPARTITION partno2 VALUES in (5, 6)
      ),
      PARTITION p1 VALUES in (3, 4)(
        SUBPARTITION partno3 VALUES in (1, 2),
        SUBPARTITION partno4 VALUES in (3, 4),
        SUBPARTITION partno5 VALUES in (5, 6)
      ),
      PARTITION p2 VALUES in (5, 6)(
        SUBPARTITION partno6 VALUES in (1, 2),
        SUBPARTITION partno7 VALUES in (3, 4),
        SUBPARTITION partno8 VALUES in (5, 6)
      )
    );
  • LIST COLUMNS-LIST类型的使用示例
    CREATE TABLE tbl_list_columns_list
    (
        col1 INT,
        col2 INT,
        col3 varchar(20),
        col4 DATE
    )
    PARTITION BY LIST COLUMNS(col3)
    SUBPARTITION BY LIST (col1)
    (
       PARTITION europe VALUES in ('FRANCE', 'ITALY')(
    	SUBPARTITION p0 VALUES in (1, 2),
            SUBPARTITION p1 VALUES in (3, 4),
            SUBPARTITION p2 VALUES in (5, 6)
       ),
       PARTITION asia VALUES in ('INDIA', 'PAKISTAN')(
    	SUBPARTITION p3 VALUES in (1, 2),
            SUBPARTITION p4 VALUES in (3, 4),
            SUBPARTITION p5 VALUES in (5, 6)
       ),
       PARTITION americas VALUES in ('US', 'CANADA')(
    	SUBPARTITION p6 VALUES in (1, 2),
            SUBPARTITION p7 VALUES in (3, 4),
            SUBPARTITION p8 VALUES in (5, 6)
       )
    );
support.huaweicloud.com/usermanual-gaussdbformysql/gaussdbformysql_05_0324.html