Hive Basics 1

hadoop hive (emphasis) day-6

He is a storage warehouse

1) Hive metadata (similar to tables, column lengths, etc.) storage On mysql

Create/copy to create a new table

1)create table table_name like old_table //only table

2)create table table_name as select * from old_table

Four methods to add data:

1) insert into table_name select’data’ union all followed by data

2) with t as (select data )insert into table_name select * from t;

3) 1) Add when creating the table: location’hdfs path’

? 2) Upload local files to hdfs

? 3) The data will be automatically imported into the table

4) load data local inpath’path’ into table table name (if local is not added, the data in hdfs can be added)

< p>Clear the data in the table: truncate table table_name;

Command

1) View more detailed information of the table: desc formatted table name

2) Display the table :Show create table name

3) Clear the data in the table: truncate table table_name;

Notes

1) When creating an external table, add an external, Add the specified address location’hdfs file address’ at the bottom of it.

2) The temporary table is created while adding a temporary

Example 1:

//Use database

use mydemo; (default database name: default)
//Create a new table
create table userinfos(
userid int,
username structfirstname:string,lastname:string,
password string,
likes array,
scores map
)
row format delimited
fields terminated by ‘|‘
collection items terminated by ‘,‘
map keys terminated by ‘:’
stored as textfile;

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4406 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.