添加字段

Add/Replace Columns

语法

  1. ALTER TABLE table_name ADD|REPLACE COLUMNS (col_name data_type [COMMENT col_comment], ...)

样例

  1. CREATE EXTERNAL TABLE
  2. IF NOT EXISTS `bigdata.uxin_car_had_sale_origin` (
  3. `occur_timestamp` string COMMENT '爬取日期',
  4. `car_id` string COMMENT '车辆ID'
  5. )
  6. PARTITIONED BY (dt STRING, hour STRING)
  7. ROW FORMAT
  8. DELIMITED FIELDS TERMINATED BY '\t'
  9. LINES TERMINATED BY '\n'
  10. STORED AS TEXTFILE
  11. LOCATION '/data/uxin/origin/car_had_sale';
  12. alter table `bigdata.uxin_car_had_sale_origin` add columns(
  13. `price` INT COMMENT '车辆报价'
  14. );
文档更新时间: 2019-06-26 10:53   作者:admin