创建mysql表,hive表
创建mysql表:
create table people(
id INT,
name VARCHAR(100),
age INT,
salary int COMMIT '薪资',
analysis_one double,
analysis_two double,
row_guid VARCHAR(100)
)
创建hive(分区表):
CREATE TABLE page_view(
viweTime INT,
useri BIGINT,
page_url STRING,
referrer_url STRING,
ip STRING COMMIT 'IP Address of the User')
COMMIT 'This is the page view table'
PARTITIONED BY(dt STRING,country STRING)
CLUSTERED BY(userid) INTO 32 BUCKETS
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\t'
STORED AS SEQUENCEFILE;
hive表的创建过程:
create database IF NOT EXISTS hdfswriter;
use hdfswriter;
create table text_table(
col1 STRING
col2 STRING
col3 STRING
)
row format delimited
fields terminated by "\t"
STORED AS TEXTFILE;