Q1
True / FalseThe COUNT function in PostgreSQL can be used to count both rows and specific column values.
The COUNT function can count all rows when used as COUNT(*) or specific column values when used as COUNT(column_name).
Q2
True / FalseIn PostgreSQL, the SUM function can only be used with numeric data types.
The SUM function is designed to add up numeric values and cannot be used with non-numeric data types.
Q3
True / FalseThe AVG function in PostgreSQL ignores NULL values in the column it operates on.
The AVG function calculates the average by ignoring NULL values in the column.
Q4
True / FalseIn PostgreSQL, the MIN and MAX functions can be used with date and time data types.
The MIN and MAX functions can be used with various data types, including numeric, string, and date/time.
Q5
True / FalseUsing the SUM function on an empty set of rows in PostgreSQL will return NULL.
Using the SUM function on an empty set of rows will return 0, not NULL.
Q6
True / FalseThe COUNT function with a DISTINCT keyword in PostgreSQL counts all unique non-null values.
The COUNT(DISTINCT column_name) function counts only unique non-null values in the specified column.
Q7
True / FalseIn PostgreSQL, the SUM and AVG functions can be used in combination with the GROUP BY clause to calculate sums and averages for groups of rows.
The SUM and AVG functions can be used with the GROUP BY clause to calculate sums and averages for each group of rows.
Q8
True / FalseIn PostgreSQL, the COUNT function can be used with a conditional expression to count rows that meet specific criteria.
You can use the COUNT function with a conditional expression like COUNT(CASE WHEN condition THEN 1 ELSE NULL END) to count rows meeting specific criteria.
Q9
True / FalseWhen using the AVG function in PostgreSQL, if all values in the column are NULL, the result will be NULL.
If all values in the column are NULL, the AVG function will return NULL because there are no non-null values to average.
Q10
True / FalseIn PostgreSQL, combining MIN and MAX functions with window functions allows for calculating minimum and maximum values over specific partitions of data.
PostgreSQL supports window functions, and combining MIN and MAX with window functions allows for calculating minimum and maximum values over defined partitions of data, providing more granular control over data analysis.
Q26
Multiple ChoiceIdentify the SQL scripts that correctly combine multiple aggregate functions in a single query in PostgreSQL.
Combining multiple aggregate functions in a single query is a common requirement. The correct scripts will demonstrate how to calculate different aggregate values for each department.