Skip to content

Instantly share code, notes, and snippets.

@vithalsamp
Created February 25, 2018 11:40
Show Gist options
  • Select an option

  • Save vithalsamp/a991c92295657c4433afb6ce72da1e9e to your computer and use it in GitHub Desktop.

Select an option

Save vithalsamp/a991c92295657c4433afb6ce72da1e9e to your computer and use it in GitHub Desktop.
create EXTERNAL TABLE IF NOT EXISTS stud_ext
(STUD_ID int,
DEPT_ID int,
NAME string
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/data/stud_list';
Query: select * from stud_ext
+---------+---------+-------+
| stud_id | dept_id | name |
+---------+---------+-------+
| 101 | 201 | 'AAA' |
| 102 | 202 | 'BBB' |
| 103 | 203 | 'CCC' |
| 104 | 204 | 'DDD' |
| 105 | 201 | 'EEE' |
+---------+---------+-------+
Fetched 6 row(s) in 5.56s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment