4.2 Selection as aggregation

 

https://c.scudata.com/article/1729154065380


Find the information of the employee with the maximu salary in the company.

SPL

A B
1 =file(“EMPLOYEE.csv”).import@tc()
2 =A1.maxp(SALARY) /One member with the maximum salary
3 =A1.maxp@a(SALARY) /All members with the maximum salary

SQL

1. One member with the maximum salary

SELECT *
FROM EMPLOYEE
ORDER BY SALARY DESC
FETCH FIRST 1 ROWS ONLY;

2. All members with the maximum salary

SELECT * FROM EMPLOYEE
WHERE SALARY = (SELECT MAX(SALARY) FROM EMPLOYEE);

Python

df = pd.read_csv('../EMPLOYEE.csv')
max_salary_emp = df.nlargest(1,'SALARY') /#One member with the maximum salary
max_salary_emp_all = df.nlargest(1,'SALARY',keep='all') /#All members with the maximum salary

https://c.scudata.com/article/1729154235068

https://c.scudata.com/article/1728995786121