返回数据仓库技术
数据仓库技术站长发布

HIVE表DLL操作(二)

2026.11.18 2 分钟读完

第1关
#******* Begin *******#
echo "
create database if not exists test1;
create table if not exists test1.student(Sno INT,name STRING,age INT,sex STRING,score STRUCT<Chinese:FLOAT,Math:FLOAT,English:FLOAT>);
create view student_view as select Sno,name,age,sex,score from test1.student;
alter view student_view rename to student_info_views;
drop view if exists student_info_views;
"
#******* End *******#
第2关
#******* Begin *******#
echo "
create database if not exists test2;
create table if not exists test2.student(Sno INT,name STRING,age INT,sex STRING,score STRUCT<Chinese:FLOAT,Math:FLOAT,English:FLOAT>) row format delimited fields terminated by ',' collection items terminated by '-';
load data local inpath '/home/student.txt' overwrite into table student;
create index student_index on table student(Sno) as 'org.apache.hadoop.hive.ql.index.compact.CompactIndexHandler' with deferred rebuild in table student_index_table;
drop index if exists student_index on student;
"
#******* End *******#

20261118.txtTXT · 1 KB · 点击下载 下载

如以上代码格式错误请下载txt版本

同类内容

1 篇