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;
通过已有表创建新表(仅创建表结构)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');建表后,通过