Several aggregate functions in one query
SQL allows you including several aggregate functions in the same query. For example, we might want to receive both the lowest and the highest GPA for each group. In SQL, such a query would look like this:
SELECT s.group_number, MIN(s.gpa), MAX(s.gpa)
FROM Student s
GROUP BY s.group_number
This query will return the lowest and the highest GPA for each group. With Pony you can use the same approach:
select((s.group, min(s.gpa), max(s.gpa)) for s in Student)