tests for SQL aggregate function