Q1
True / FalseThe HAVING clause in PostgreSQL is used to filter rows after the GROUP BY clause.
The HAVING clause is used to filter groups of rows created by the GROUP BY clause.
Q2
True / FalseIn PostgreSQL, the HAVING clause can be used without a GROUP BY clause.
The HAVING clause is specifically used to filter groups created by the GROUP BY clause, so it cannot be used without it.
Q3
True / FalseThe HAVING clause in PostgreSQL can include aggregate functions like SUM and COUNT.
The HAVING clause can include aggregate functions to filter groups based on aggregate calculations.
Q4
True / FalseIn PostgreSQL, the HAVING clause is executed before the GROUP BY clause.
The HAVING clause is executed after the GROUP BY clause.
Q5
True / FalseYou can use the HAVING clause in PostgreSQL to filter individual rows in a result set.
The HAVING clause is used to filter groups, not individual rows. For filtering individual rows, the WHERE clause is used.
Q6
True / FalseIn PostgreSQL, it is possible to use a subquery within a HAVING clause.
Subqueries can be used within a HAVING clause to filter groups based on the results of the subquery.
Q7
True / FalsePostgreSQL allows the use of window functions directly in the HAVING clause.
Window functions cannot be directly used in the HAVING clause. They are used in the SELECT clause or ORDER BY clause.
Q8
True / FalseIn PostgreSQL, the HAVING clause can reference columns that are not included in the GROUP BY clause or an aggregate function.
Columns referenced in the HAVING clause must either be part of the GROUP BY clause or used in an aggregate function.
Q9
True / FalseThe HAVING clause can be used in conjunction with the ORDER BY clause in PostgreSQL.
The HAVING clause can be used to filter groups, and the ORDER BY clause can then be used to sort the filtered results.
Q10
True / FalseIn PostgreSQL, you can use the HAVING clause to filter results based on a calculated column alias defined in the SELECT clause.
In PostgreSQL, the HAVING clause cannot reference column aliases defined in the SELECT clause. The column must be recalculated or referenced directly.
Q23
Multiple ChoiceDetermine the SQL scripts that correctly use the HAVING clause with aggregate functions in PostgreSQL.
The HAVING clause is typically used in conjunction with aggregate functions like SUM, AVG, COUNT, etc. The correct scripts will demonstrate how to filter groups based on the average salary.