CREATE EXTERNAL TABLE tb_sample (
userid INT,
viewTime INT
)
PARTITIONED BY (year int, month int)
STORED AS PARQUET
LOCATION '/data/tb_sample'
INSERT INTO tb_sample PARTITION(year=2020, month=5) VALUES (2020,5);
INSERT INTO tb_sample PARTITION(year=2020, month=6) VALUES (2020,6);
INSERT INTO tb_sample PARTITION(year=2021, month=6) VALUES (2021,6);
https://dwgeek.com/hive-insert-into-partition-table-and-examples.html/