create table new_table like old_table;
create table new_table as select * from old_table;
--建表
create table table_name (
id int
,name string
)
--插入数据
insert into table_name values(1,'colin');
- 建表后,通过load data加载数据(通过load data方式建表时,必须指定列分隔符)
--建表
create table table_name (
id int
,name string
)
row format delimited
fields terminated by ','
lines terminated by '\n';
--加载数据
load data local inpath '/home/load_data.txt' into table table_name;
- 建表后,通过hadoop fs -put命令加载数据(通过hadoop fs -put方式建表时,必须指定列分隔符)
--建表
create table table_name (
id int
,name string
)
row format delimited
fields terminated by ','
lines terminated by '\n';
--加载数据
hadoop fs -put ./load_data.txt /user/hive/warehouse/test.db/table_nane/
|