· 9 years ago · Oct 23, 2016, 01:14 PM
1CREATE TABLE employee_master STORED as ORC as SELECT * FROM EMPLOYEE_SAMPLE;
2ALTER TABLE employee_master clustered by (employeeid) into 2 buckets;
3ALTER TABLE employee_master SET TBLPROPERTIES ('transactional'='true');`
4
5Update employee_master SET department="FIRE DEPARTMENT" where employeeid=100;
6Update employee_master SET department="STREETS & SAN DEPARTMENT" where employeeid=52;
7Update employee_master SET department="FAMILY & SUPPORT SERVICES" where employeeid=26;
8Update employee_master SET department="POLICE DEPARTMENT" where employeeid=54;
9Update employee_master SET department="FIRE DEPARTMENT" where employeeid=14;
10
11CREATE IF NOT EXISTS employee_master (
12 employeeid INT,
13 name string,
14 jobtitle string,
15 department string,
16 annualsalary DECIMAL(10,2))
17COMMENT "Employee Master - Table"
18CLUSTERED BY (employeeid) INTO 2 BUCKETS
19STORED AS ORC
20TBLPROPERTIES ("transactional"="true")