Computer Science
Aggregate functions can be used in the select list or the …………… clause of a select statement. They cannot be used in a …………… clause.
- Where, having
- Having, where
- Group by, having
- Group by, where
Answer
Having, where
Reason — Aggregate functions can be used in the select list or the HAVING clause of a select statement. But they cannot be used in a WHERE clause. The reason for this is that the WHERE clause filters rows before any grouping or aggregation occurs, while HAVING clause applies conditions to groups after the data has been grouped using the GROUP BY clause.
Related Questions
A …………… is a query that retrieves rows from more than one table or view:
- Start
- End
- Join
- All of these
The HAVING clause does which of the following ?
- Acts EXACTLY like a WHERE clause.
- Acts like a WHERE clause but is used for columns rather than groups.
- Acts like a WHERE clause but is used for groups rather than rows.
- Acts like a WHERE clause but is used for rows rather than columns.
SQL applies conditions on the groups through …………… clause after groups have been formed.
- Group by
- With
- Where
- Having
Which clause is used with "aggregate functions" ?
- GROUP BY
- SELECT
- WHERE
- Both (1) and (3)