#003366
#CCCCCC
#4CAF50
#FF9800
#FFFFFF
-- Enable dynamic partitioning
SET hive.exec.dynamic.partition = true;
SET hive.exec.dynamic.partition.mode = nonstrict;
-- Create a partitioned and bucketed table
CREATE TABLE employee (
id INT,
name STRING,
age INT,
salary FLOAT
)
PARTITIONED BY (city STRING)
CLUSTERED BY (id) INTO 4 BUCKETS
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ',';
-- Insert data into the partitioned and bucketed table
INSERT INTO TABLE employee PARTITION (city)
VALUES
(1, 'Alice', 30, 70000.0, 'New York'),
(2, 'Bob', 25, 60000.0, 'Los Angeles'),
(3, 'Charlie', 35, 80000.0, 'Chicago'),
(4, 'David', 28, 65000.0, 'Houston'),
(5, 'Eve', 32, 72000.0, 'Phoenix'),
(6, 'Frank', 29, 68000.0, 'Philadelphia');