Dear Learner,

Hope you are doing good.

There are some errors in the commands which you are trying to execute:

(i)  After creating the table employee you are not loading the data into that table.

(ii) In employee table you are not specifying the column as category.

(iii) In the Last command you are giving the wrong table name.

Please use the below commands to get the desired result:

CREATE TABLE IF NOT EXISTS employee3(Name string, Sal int, Location string, category string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',';

load data local inpath '/home/edureka/hive' into table employee3;

SET hive.exec.dynamic.partition.mode = nonstrict;
SET hive.exec.dynamic.partition = true;
SET hive.exec.enforce.bucketing = true;

CREATE TABLE IF NOT EXISTS employee6(Name string, Sal int, Location string)Partitioned by (category string) clustered by (name ) INTO 4 buckets ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' stored as textfile;

from employee3 emp INSERT OVERWRITE TABLE employee6 PARTITION(category) select emp.name,emp.sal,emp.Location,emp.category DISTRIBUTE BY category;

Please refer to the below screen shot:


Note : I have used my Sample Data set.

Please try the commands at your end and let us know if you face any issue.