Which two are true about aggregate functions? (Choose two.)

  1. You can use aggregate functions in any clause of a SELECT statement.

  2. You can use aggregate functions only in the column list of the SELECT clause and in the WHERE clause of a SELECT statement.

  3. You can mix single row columns with aggregate functions in the column list of a SELECT statement by grouping on the single row columns.

  4. You can pass column names, expressions, constants, or functions as parameters to an aggregate function.

  5. You can use aggregate functions on a table, only by grouping the whole table as one single group.

  6. You cannot group the rows of a table by more than one column while using aggregate functions.


Correct Option: C,D

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) You can use aggregate functions in any clause of a SELECT statement - This option is incorrect. Aggregate functions can only be used in the SELECT clause, HAVING clause, or ORDER BY clause of a SELECT statement.

Option B) You can use aggregate functions only in the column list of the SELECT clause and in the WHERE clause of a SELECT statement - This option is incorrect. As mentioned in the explanation for Option A, aggregate functions can also be used in the HAVING clause and ORDER BY clause.

Option C) You can mix single row columns with aggregate functions in the column list of a SELECT statement by grouping on the single row columns - This option is correct. When using aggregate functions in the SELECT clause, you can mix them with single row columns by grouping on the single row columns. This allows you to perform calculations on groups of rows while also displaying individual row data.

Option D) You can pass column names, expressions, constants, or functions as parameters to an aggregate function - This option is correct. Aggregate functions can take column names, expressions, constants, or functions as parameters. This allows you to perform calculations on specific columns or values within the aggregate function.

Option E) You can use aggregate functions on a table, only by grouping the whole table as one single group - This option is incorrect. Aggregate functions can be used on a table by grouping the rows based on one or more columns. This allows you to calculate aggregate values for different groups of rows.

Option F) You cannot group the rows of a table by more than one column while using aggregate functions - This option is incorrect. You can group the rows of a table by multiple columns while using aggregate functions. This allows you to calculate aggregate values for different combinations of grouped columns.

Therefore, the correct answers are Option C and Option D.

Find more quizzes: