PostgreSQL Database Quiz Questions

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

In PostgreSQL, the = operator is used to compare two values for equality.

Q2
True / False

In PostgreSQL, the != operator is equivalent to the <> operator.

Q3
True / False

The < operator in PostgreSQL can be used to check if one value is less than another.

Q4
True / False

In PostgreSQL, the BETWEEN operator is inclusive of the boundary values.

Q5
True / False

The LIKE operator in PostgreSQL is used to compare numeric values.

Q6
True / False

In PostgreSQL, the IN operator can be used to check if a value matches any value in a list.

Q7
True / False

In PostgreSQL, the ILIKE operator is case-sensitive.

Q8
True / False

PostgreSQL supports the IS DISTINCT FROM operator to handle NULL comparisons more effectively.

Q9
True / False

The SIMILAR TO operator in PostgreSQL uses POSIX regular expressions for pattern matching.

Q10
True / False

In PostgreSQL, the IS NOT DISTINCT FROM operator treats NULLs as equal for comparison purposes.

Q11
Single Choice

Question: Which of the following SQL statements will correctly compare two integer values in PostgreSQL?

SQL Code
SELECT * FROM employees WHERE salary > 50000;
Q12
Single Choice

What is the result of the following comparison in PostgreSQL?

SQL Code
SELECT 10 = 10;
Q13
Single Choice

How would you check if two columns have the same value in PostgreSQL?

SQL Code
SELECT * FROM products WHERE price = cost;
Q14
Single Choice

Which PostgreSQL SQL statement will return rows where the age is not equal to 30?

SQL Code
SELECT * FROM users WHERE age <> 30;
Q15
Single Choice

What is the correct SQL statement to find records where amount is less than or equal to 1000 in PostgreSQL?

SQL Code
SELECT * FROM transactions WHERE amount <= 1000;
Q16
Single Choice

In PostgreSQL, how can you retrieve rows where the date column is greater than '2024-01-01'?

SQL Code
SELECT * FROM events WHERE date > '2024-01-01';
Q17
Single Choice

Which of the following queries correctly uses the BETWEEN operator in PostgreSQL to filter rows based on a range?

SQL Code
SELECT * FROM orders WHERE order_date BETWEEN '2024-01-01' AND '2024-12-31';
Q18
Single Choice

How would you select rows in PostgreSQL where the quantity is exactly 10 or less than 5?

SQL Code
SELECT * FROM inventory WHERE quantity = 10 OR quantity < 5;
Q19
Single Choice

In PostgreSQL, what is the result of the following comparison?

SQL Code
SELECT '2024-01-01' > '2023-12-31';
Q20
Single Choice

Which PostgreSQL query will correctly filter rows where sales is not greater than 500 and also not equal to 300?

SQL Code
SELECT * FROM revenue WHERE sales <= 500 AND sales <> 300;
Q21
Multiple Choice

Which SQL queries correctly use the '=' operator for comparison in PostgreSQL?

Q22
Multiple Choice

Which SQL queries correctly use the '!=' operator for comparison in PostgreSQL?

Q23
Multiple Choice

Which SQL queries correctly use the '>' operator for comparison in PostgreSQL?

Q24
Multiple Choice

Which SQL queries correctly use the '<' operator for comparison in PostgreSQL?

Q25
Multiple Choice

Which SQL queries correctly use the '>=' operator for comparison in PostgreSQL?

Q26
Multiple Choice

Which SQL queries correctly use the '<=' operator for comparison in PostgreSQL?

Q27
Multiple Choice

Which SQL queries correctly use the '<>' operator for comparison in PostgreSQL?

Q28
Multiple Choice

Which SQL queries correctly combine comparison operators with logical operators?

Q29
Multiple Choice

Which SQL queries correctly use comparison operators in a subquery?

Q30
Multiple Choice

Which SQL queries correctly handle NULL values with comparison operators?