4.2 Selection as aggregation
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
4.3 Set aggregation
Example codes for comparing SPL, SQL, and Python
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_SPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL