分类 hive 下的文章

SELECT
upc_y,
standard_id
FROM
table lateral VIEW explode(split(upc, ';')) t1 AS upc_y

注意这里对特殊字符要进行转义: '#\$%#' ';'
(1)有的符号是特殊字符,有的不是
'''

 select 
     sku_name
     sku_name_cleans,       
 from aa
 lateral VIEW explode(split(sku_name, '#\\\$%#')) t1 AS sku_name_cleans
 where 
      dt='2021-08-04'

'''

一、建表

CREATE TABLE a like b
查看hive建表语句:show create table tablename;

二、复制数据

set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
insert into table A partition (dt,data_type)
select * from B WHERE dt=sysdate(-1)

三、查看表结构

describe tablename; 简写:desc tablename;

四、排序

SELECT

*

FROM

(
 SELECT
    *,
    row_number() over(PARTITION by cid ORDER by rand() ) as rank
FROM
    table
WHERE
    dt ='2021-09-26'

 ) a  
 WHERE a.rank <101