当我增加新的字段 user_addr 后,新增字段前的数据该列显示为 NULL ,那么如果我们新增一条数据呢?
INSERT INTO TABLE user_info
SELECT '003' as user_id, 'jack' as user_name, '34' as age, '广东深圳' as user_addr
;
CREATE TABLE IF NOT EXISTS cust_info
(
user_id string COMMENT '用户ID'
,user_name string COMMENT '用户姓名'
,user_age string COMMENT '用户年龄'
)
COMMENT '客户信息表'
PARTITIONED BY (ds STRING COMMENT'分区')
;
INSERT OVERWRITE TABLE cust_info partition(ds = '20220223')
SELECT '001' as user_id, 'kyle' as user_name, '23' as user_age
UNION ALL
SELECT '002' as user_id, 'lisa' as user_name, '25' as user_age
;
INSERT OVERWRITE TABLE cust_info partition(ds = '20220223')
SELECT '001' as user_id, 'kyle' as user_name, '23' as user_age, '中国深圳' as user_addr
UNION ALL
SELECT '002' as user_id, 'lisa' as user_name, '25' as user_age, '中国北京' as user_addr
;