PostgreSQL Database Quiz Questions

Course Name:PostgreSQL
Chapter Name:Chapter 7 - DQL (Data Query Language)
Current Quiz Count:30
Progress
0%
Q1
True / False

The COUNT function in PostgreSQL can be used to count both rows and specific column values.

Q2
True / False

In PostgreSQL, the SUM function can only be used with numeric data types.

Q3
True / False

The AVG function in PostgreSQL ignores NULL values in the column it operates on.

Q4
True / False

In PostgreSQL, the MIN and MAX functions can be used with date and time data types.

Q5
True / False

Using the SUM function on an empty set of rows in PostgreSQL will return NULL.

Q6
True / False

The COUNT function with a DISTINCT keyword in PostgreSQL counts all unique non-null values.

Q7
True / False

In 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.

Q8
True / False

In PostgreSQL, the COUNT function can be used with a conditional expression to count rows that meet specific criteria.

Q9
True / False

When using the AVG function in PostgreSQL, if all values in the column are NULL, the result will be NULL.

Q10
True / False

In PostgreSQL, combining MIN and MAX functions with window functions allows for calculating minimum and maximum values over specific partitions of data.

Q11
Single Choice

What does the COUNT(*) function do in PostgreSQL?

Q12
Single Choice

Which PostgreSQL function would you use to calculate the average value of a numeric column?

Q13
Single Choice

Given a table employees with a column salary, which function will return the highest salary?

Q14
Single Choice

What will the following SQL query return in PostgreSQL?

SQL Code
SELECT COUNT(DISTINCT department) FROM employees;
Q15
Single Choice

How would you calculate the total of all sales amounts in a sales table in PostgreSQL?

Q16
Single Choice

What does the following PostgreSQL query return?

SQL Code
SELECT AVG(salary) FROM employees WHERE department = 'HR';
Q17
Single Choice

What will the following SQL query return in PostgreSQL?

SQL Code
SELECT department, SUM(salary)
FROM employees
GROUP BY department;
Q18
Single Choice

In PostgreSQL, which function can be used in conjunction with GROUP BY to find the department with the lowest average salary?

Q19
Single Choice

Given the following PostgreSQL query, what result will be returned?

SQL Code
SELECT department, COUNT(*)
FROM employees
GROUP BY department
HAVING COUNT(*) > 10;
Q20
Single Choice

Which PostgreSQL query correctly returns the average salary of employees, excluding the highest and lowest salary?

Q21
Multiple Choice

Which SQL scripts correctly use the COUNT function to find the number of employees in each department in PostgreSQL?

Q22
Multiple Choice

Identify the SQL scripts that correctly calculate the total salary in each department using the SUM function in PostgreSQL.

Q23
Multiple Choice

Which SQL scripts correctly calculate the average salary in each department using the AVG function in PostgreSQL?

Q24
Multiple Choice

Select the SQL scripts that correctly find the highest salary in each department using the MAX function in PostgreSQL.

Q25
Multiple Choice

Determine the SQL scripts that correctly find the lowest salary in each department using the MIN function in PostgreSQL.

Q26
Multiple Choice

Identify the SQL scripts that correctly combine multiple aggregate functions in a single query in PostgreSQL.

Q27
Multiple Choice

Which SQL scripts correctly use the AVG function with a WHERE clause in PostgreSQL?

Q28
Multiple Choice

Determine the SQL scripts that correctly use the COUNT function with DISTINCT in PostgreSQL.

Q29
Multiple Choice

Which SQL scripts correctly calculate the total and average salary for employees with a specific job role in PostgreSQL?

Q30
Multiple Choice

Identify the SQL scripts that correctly use multiple aggregate functions with conditional expressions in PostgreSQL.