需求:
工作中需要计算农业全要素生产率数据,需要利用HiveQL进行数据仓库提取,然后进行转换式计算,最后需要进行要素生产效率分析,用于后续的深度数据挖掘。
解决:
CREATE TABLE IF NOT EXISTS mytable (
col1 STRING,
col2 INT,
col3 DOUBLE
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
LOAD DATA LOCAL INPATH '/path/to/data.txt' INTO TABLE mytable;
SELECT * FROM mytable;
SELECT * FROM mytable WHERE col2 > 10;
SELECT col1, COUNT(*) FROM mytable GROUP BY col1;
SELECT * FROM mytable ORDER BY col2 DESC;
INSERT OVERWRITE LOCAL DIRECTORY '/path/to/output' SELECT * FROM mytable;
数据来源: 农业全要素生产率数据
标签:要素,HiveQL,生产率,col2,mytable,col1,SELECT From: https://www.cnblogs.com/idatawork/p/17781876.html