You can specify a table group when creating a table. Syntax for the SQL statement:
CREATE TABLE table_name (
column_name data_type [, column_name data_type]
) TABLEGROUP tablegroup_name ;
Example: Specifying a table group when creating a table
The following example creates an order table and order statement, and needs to join the two tables for queries. We recommend putting the two tables into the same table group.
obclient> create table ordr (
o_w_id int
, o_d_id int
, o_id int
, o_c_id int
, o_carrier_id int
, o_ol_cnt int
, o_all_local int
, o_entry_d date
, index iordr(o_w_id, o_d_id, o_c_id, o_id) local
, primary key ( o_w_id, o_d_id, o_id )
)tablegroup tpcc_group partition by hash(o_w_id) partitions 6;
Query OK, 0 rows affected (0.13 sec)
obclient> create table ordl (
ol_w_id int
, ol_d_id int
, ol_o_id int
, ol_number int
, ol_delivery_d date
, ol_amount decimal(6, 2)
, ol_i_id int
, ol_supply_w_id int
, ol_quantity int
, ol_dist_info char(24)
, primary key (ol_w_id, ol_d_id, ol_o_id, ol_number )
)tablegroup tpcc_group partition by hash(ol_w_id) partitions 6;