hive 分组+排序 1、创建外部表employess41_table,表名中加上座位号 CREATE EXTERNAL TABLE IF NOT EXISTS employess01_table( staff_name STRING, staff_age INT, staff_salary FLOAT, late_deduction FLOAT, staff_dept STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' STORED AS textfile LOCATION '/hive'; 2、将下列数据使用基本插入方式插入到表中,并查看表中数据。 insert into table employess41_table values ("Lilith Hardy",30,6000,50,"Finance Department"), ("Byron Green",36,5000,25,"Personnel Department"), ("Yvette Ward",21,4500,15.5,""), ("Arlen Esther",28,8000,20,"Finance Department"), ("Rupert Gold",39,10000,66,"R&D Department"), ("Deborah Madge",41,6500,0,"R&D Department"), ("Tim Springhall",22,6000,36.5,"R&D Department"), ("Olga Belloc",36,5600,10,"Sales Department"), ("Bruno Wallis",43,6700,0,"Personnel Department"), ("Flora Dan",27,4000,35,"Sales Department");
时间: 2023-07-19 12:04:32 浏览: 83
3、按照部门分组,按照工资降序排序,显示员工姓名和工资。
```
SELECT staff_name, staff_salary
FROM employess41_table
WHERE staff_dept != ""
ORDER BY staff_dept, staff_salary DESC;
```
4、按照部门分组,按照工资降序排序,显示员工姓名、工资和部门。
```
SELECT staff_name, staff_salary, staff_dept
FROM employess41_table
WHERE staff_dept != ""
ORDER BY staff_dept, staff_salary DESC;
```
阅读全文