在Hive中的内部表操作数据:
(1)插入数据
insert into 表名[(字段名, 字段名, …)] values(值, 值, …);
(2)查看数据
select * from 表名;
(3)清空数据
1.truncate table 表名;
use sz41db_machine;
create table teacher(
id int,
name string,
gender string
) row format delimited
fields terminated by "\t";
insert into teacher values (1,"fangGE","Man"),(2,"文
文","Woman");
select * from teacher;
truncate table teacher;
2.use sz41db_machine;
show tables ;
create table student(
id int,
stu_name string
)row format delimited
fields terminated by ",";
select * from student;
(1)当数据表字段内容对应了表目录下的文件数据,则会自动映射数据内容
到Hive表中;
(2)发现当把数据表导入到HDFS对应目录后,这种插入数据的方式
比直接insert要更高效。
————————————————