4.3 集合聚合

 

4.2 选出聚合


1. 公司最低的 10 个工资
2. 公司工资最低的 10 个员工

SPL

A B
1 =file(“EMPLOYEE.csv”).import@tc()
2 =A1.top(10,SALARY) / 最低的 10 个工资
3 =A1.top(10;SALARY) / 工资最低的 10 个员工

SQL

1. 最低的 10 个工资

SELECT *
FROM (
  SELECT SALARY
  FROM EMPLOYEE
  ORDER BY SALARY)
WHERE ROWNUM <= 10;

2. 工资最低的 10 个员工

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'] 	#最低的10个工资
low_salary_10 = df.nsmallest(10, 'SALARY')		#工资最低的10个员工

4.4 分组聚合
SPL SQL Python 代码示例对比