PostgreSQL Database Quiz Questions

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

In PostgreSQL, the DISTINCT keyword is used to remove duplicate rows from the result set.

Q2
True / False

In PostgreSQL, using DISTINCT in a SELECT statement will still return duplicate rows if used incorrectly.

Q3
True / False

In PostgreSQL, the DISTINCT keyword can be used with a single column or multiple columns in a query.

Q4
True / False

In PostgreSQL, the DISTINCT keyword can be used with aggregate functions like COUNT.

Q5
True / False

In PostgreSQL, using DISTINCT always guarantees faster query performance.

Q6
True / False

In PostgreSQL, DISTINCT can be used within a subquery to ensure unique results before combining them with the outer query.

Q7
True / False

In PostgreSQL, using DISTINCT ON (column_name) allows you to specify which duplicates to keep based on ordering.

Q8
True / False

In PostgreSQL, the DISTINCT keyword can be combined with the GROUP BY clause without any issues.

Q9
True / False

In PostgreSQL, DISTINCT can be used in window functions.

Q10
True / False

In PostgreSQL, using DISTINCT in a SELECT statement without specifying any columns will result in a syntax error.

Q11
Single Choice

Which of the following SQL statements will return a list of unique city names from a customers table in PostgreSQL?

Q12
Single Choice

What will the following SQL statement return in PostgreSQL?

SQL Code
SELECT DISTINCT country FROM customers;
Q13
Single Choice

Which PostgreSQL keyword is used to remove duplicate values in a query result set?

Q14
Single Choice

Given the following table orders with columns order_id, customer_id, and order_date, which SQL statement will retrieve a list of unique customer_ids?

Q15
Single Choice

What will the following PostgreSQL query return?

SQL Code
SELECT DISTINCT ON (department) department, salary FROM employees ORDER BY department, salary DESC;
Q16
Single Choice

In PostgreSQL, what is the outcome of the following SQL query?

SQL Code
SELECT DISTINCT city, state FROM addresses;
Q17
Single Choice

Consider the products table with the columns product_name, category, and price. How would you write a query to return unique categories where the average price of products is above $50?

Q18
Single Choice

What will the following PostgreSQL query return?

SQL Code
SELECT DISTINCT customer_id, COUNT(order_id) FROM orders GROUP BY customer_id;
Q19
Single Choice

Which SQL query will return a distinct list of customer names along with their corresponding order dates from the orders table?

Q20
Single Choice

Consider the employees table with the columns employee_id, department, and salary. Which query will return the distinct list of departments and the average salary of employees in each department?

Q21
Multiple Choice

Identify the SQL scripts that correctly perform a basic DISTINCT operation in PostgreSQL.

Q22
Multiple Choice

Select the SQL scripts that correctly perform a DISTINCT operation on multiple columns in PostgreSQL.

Q23
Multiple Choice

Determine the SQL scripts that correctly perform a DISTINCT operation with ORDER BY in PostgreSQL.

Q24
Multiple Choice

Identify the SQL scripts that correctly perform a DISTINCT operation with WHERE clause in PostgreSQL.

Q25
Multiple Choice

Select the SQL scripts that correctly perform a DISTINCT operation with JOINs in PostgreSQL.

Q26
Multiple Choice

Determine the SQL scripts that correctly perform a DISTINCT operation with aggregate functions in PostgreSQL.

Q27
Multiple Choice

Identify the SQL scripts that correctly perform a DISTINCT operation with window functions in PostgreSQL.

Q28
Multiple Choice

Select the SQL scripts that correctly perform a DISTINCT operation with UNION in PostgreSQL.

Q29
Multiple Choice

Determine the SQL scripts that correctly perform a DISTINCT operation with LIMIT in PostgreSQL.

Q30
Multiple Choice

Identify the SQL scripts that correctly perform a DISTINCT operation with GROUP BY in PostgreSQL.