Rohan Mathur
Rohan Mathur

Reputation: 15

HIVE SQL create statement

CREATE TABLE IF NOT EXISTS user.name_visits(
    date1 TIMESTAMP,
    MV String,
    visits_by_MV int
)
COMMENT ‘visits_at_MV’
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘\t’
LINES TERMINATED BY ‘\n’
;

It is saying error near BY

Upvotes: 0

Views: 87

Answers (2)

hadooper
hadooper

Reputation: 746

Below query worked for me..


CREATE TABLE IF NOT EXISTS user.name_visits(
date1 TIMESTAMP,
MV STRING,
visits_by_MV INT
)
COMMENT 'visits_at_MV'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
;


Error you are seeing could be because of the editor you are using.
If you look at your Quotation marks.. they're LEFT SINGLE QUOTATION MARK and RIGHT SINGLE QUOTATION MARK.
Only change I made was using an APOSTROPHE.

Try this way it should work

Upvotes: 1

Vineet Srivastava
Vineet Srivastava

Reputation: 23

Change single quotes with double as below:

CREATE TABLE IF NOT EXISTS user.name_visits( date1 TIMESTAMP, MV String, visits_by_MV int ) COMMENT "visits_at_MV" ROW FORMAT DELIMITED FIELDS TERMINATED BY "\t" LINES TERMINATED BY "\n" ;

Upvotes: 0

Related Questions