Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

CREATE TABLE IF NOT EXISTS employee ( eid int, name String,salary String,

destination String) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t� LINES TERMINATED
BY '\n� stored as textfile;

CREATE TABLE IF NOT EXISTS employee(empid int,fname varchar(20),lname


varchar(20),email varchar(50),phone string,hdate string,jobid varchar(20),salary
int,comm int,manid int,deptid int) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\n' stored as textfile;
drop table employee;
CREATE external TABLE IF NOT EXISTS employee_ext(empid int,fname
varchar(20),lname varchar(20),email varchar(50),phone string,hdate string,jobid
varchar(20),salary int,comm int,manid int,deptid int) ROW FORMAT DELIMITED FIELDS
TERMINATED BY '|' LINES TERMINATED BY '\n' stored as textfile;

LOAD DATA LOCAL INPATH '/home/cloudera/Desktop/EMPLOYEES1.txt' into table employee;

create table emp_phone as select empid,phone from employee;

CREATE TABLE IF NOT EXISTS employee(empid int,fname varchar(20),lname


varchar(20),email varchar(50),phone string,hdate string,jobid varchar(20),salary
int,comm int,manid int,deptid int) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\n' stored as textfile;
drop table employee;
CREATE external TABLE IF NOT EXISTS employee_ext(empid int,fname
varchar(20),lname varchar(20),email varchar(50),phone string,hdate string,jobid
varchar(20),salary int,comm int,manid int,deptid int) partitioned by(deptid) ROW
FORMAT DELIMITED FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' stored as
textfile;

You might also like