一、建表

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

标签: none

添加新评论