4.2 选出聚合
查看公司工资最高的员工信息
SPL
A | B | |
---|---|---|
1 | =file(“EMPLOYEE.csv”).import@tc() | |
2 | =A1.maxp(SALARY) | / 工资最高的 1 个成员 |
3 | =A1.maxp@a(SALARY) | / 工资最高的全部成员 |
SQL
1. 工资最高的 1 个成员
SELECT *
FROM EMPLOYEE
ORDER BY SALARY DESC
FETCH FIRST 1 ROWS ONLY;
2. 工资最高的全部成员
SELECT * FROM EMPLOYEE
WHERE SALARY = (SELECT MAX(SALARY) FROM EMPLOYEE);
Python
df = pd.read_csv('../EMPLOYEE.csv')
max_salary_emp = df.nlargest(1,'SALARY') #工资最高的1个成员
max_salary_emp_all = df.nlargest(1,'SALARY',keep='all') #工资最高的全部成员