問題文
A query has to list the departments whose average salary is above 8000, and has to leave out the employees who work part time before that average is computed. Where does each condition belong?
選択肢
- The part time condition belongs in the HAVING clause and the average condition belongs in the WHERE clause, because groups are formed before rows are filtered.
- Both conditions belong in the WHERE clause, because that clause is evaluated once for every row and can also read the result of an aggregate function.
- Both conditions belong in the HAVING clause, because that clause is evaluated once for every group and can also read the columns of the individual rows.
- The part time condition belongs in the WHERE clause and the average condition belongs in the HAVING clause, because rows are filtered before the groups are formed.