1. Preparation
First, I need to create a table and write the corresponding fields in it:
create table t_order_mt(
id UInt32,
sku_id String,
total_amount Decimal(16,2),
create_time Datetime
) engine =MergeTree
partition by toYYYYMMDD(create_time)
primary key (id)
order by (id,sku_id);
Next, you need to insert the corresponding data into it:
insert into t_order_mt values
(101,'sku_001',1000.00,'2020-06-01 12:00:00') ,
(102,'sku_002',2000.00,'2020-06-01 11:00:00'),
(102,'sku_004',2500.00,'2020-06-01 12:00:00'),
(102,'sku_002',2000.00,'2020-06-01 13:00:00'),
(102,'sku_002',12000.00,'2020-06-01 13:00:00'),
(102,'sku_002',600.00,'2020-06-02 12:00:00');
2. Error display
When I execute select * from table_name, the following problems may occur:
Code: 62. DB::Exception: Syntax error (Multi-statements are not allowed): failed at position 54 (end of query) (line 1, col 54): ;
FORMAT JSON . . (SYNTAX_ERROR) (version 21.11.6.7 (official build))
3. Solution
You only need to end the sentence after the corresponding sentence; Change to:
select * from t_order_mt;;
Results