4.3 Set aggregation
1. The 10 lowest salaries in the company.
2. The 10 employees with the lowest salaries in the company.
SPL
A | B | |
---|---|---|
1 | =file(“EMPLOYEE.csv”).import@tc() | |
2 | =A1.top(10,SALARY) | /The 10 lowest salaries |
3 | =A1.top(10;SALARY) | /The 10 employees with the lowest salaries |
SQL
1. The 10 lowest salaries
SELECT *
FROM (
SELECT SALARY
FROM EMPLOYEE
ORDER BY SALARY)
WHERE ROWNUM <= 10;
2. The 10 employees with the lowest salaries
SELECT *
FROM (
SELECT *
FROM EMPLOYEE
ORDER BY SALARY)
WHERE ROWNUM <= 10;
Python
df=pd.read_csv('../EMPLOYEE.csv')
low_salary_10=df.nsmallest(10,'SALARY')['SALARY']/#The10lowestsalaries
low_salary_10=df.nsmallest(10,'SALARY')/#The10employeeswiththelowestsalaries
4.4 Group & aggregate
Example codes for comparing SPL, SQL, and Python
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProcSPL
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