PostgreSQL Database Quiz Questions

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

In PostgreSQL, the NOT IN keyword is used to filter rows where a column's value does not match any value in a specified list.

Q2
True / False

In PostgreSQL, the NOT IN keyword can only be used with numeric values.

Q3
True / False

In PostgreSQL, using NOT IN with an empty list will always return all rows from the table.

Q4
True / False

In PostgreSQL, the NOT IN keyword is case-sensitive when used with text values.

Q5
True / False

In PostgreSQL, the NOT IN keyword can be used with subqueries to specify a dynamic list of values.

Q6
True / False

In PostgreSQL, using NOT IN with a subquery that returns NULL values will exclude rows where the column's value is NULL.

Q7
True / False

In PostgreSQL, using the NOT IN keyword with a large list of values can impact query performance.

Q8
True / False

In PostgreSQL, the NOT IN keyword can be used within a JOIN condition.

Q9
True / False

In PostgreSQL, the NOT IN keyword can be combined with other logical operators like AND and OR.

Q10
True / False

In PostgreSQL, using NOT IN with a subquery that includes NULL will ensure the query returns only non-null values.

Q11
Single Choice

Which of the following SQL statements will return all employees not working in departments 10, 20, or 30?

SQL Code
SELECT employee_id, employee_name
FROM employees
WHERE department_id NOT IN (10, 20, 30);
Q12
Single Choice

What will the following PostgreSQL query return?

SQL Code
SELECT product_name
FROM products
WHERE category_id NOT IN (1, 2, 3);
Q13
Single Choice

In PostgreSQL, which statement correctly finds orders that are not from customers 1001, 1002, and 1003?

SQL Code
SELECT order_id
FROM orders
WHERE customer_id NOT IN (1001, 1002, 1003);
Q14
Single Choice

What is the output of the following query in PostgreSQL if the table contains NULL values in the region_id column?

SQL Code
SELECT region_name
FROM regions
WHERE region_id NOT IN (1, 2, 3);
Q15
Single Choice

Given the following SQL statement, what does it return?

SQL Code
SELECT employee_id
FROM employees
WHERE salary NOT IN (5000, 7000, 10000);
Q16
Single Choice

What will the following PostgreSQL query return if the supplier_id column has duplicate values?

SQL Code
SELECT supplier_name
FROM suppliers
WHERE supplier_id NOT IN (101, 102, 103);
Q17
Single Choice

How does PostgreSQL handle a query using NOT IN when the subquery returns NULL?

SQL Code
SELECT customer_id
FROM customers
WHERE customer_id NOT IN (SELECT customer_id FROM orders WHERE order_date IS NULL);
Q18
Single Choice

What is the effect of using NOT IN in a correlated subquery in PostgreSQL?

SQL Code
SELECT employee_id
FROM employees e
WHERE department_id NOT IN (
 SELECT department_id
 FROM departments d
 WHERE e.location_id = d.location_id
);
Q19
Single Choice

In PostgreSQL, what will the following SQL query return if there are no matching product_ids in the sales table?

SQL Code
SELECT product_name
FROM products
WHERE product_id NOT IN (SELECT product_id FROM sales);
Q20
Single Choice

Which of the following PostgreSQL queries correctly finds customers who have made no purchases in the last year?

SQL Code
SELECT customer_id
FROM customers
WHERE customer_id NOT IN (
 SELECT customer_id
 FROM orders
 WHERE order_date >= CURRENT_DATE - INTERVAL '1 year'
);
Q21
Multiple Choice

Identify the SQL scripts that correctly use the NOT IN operator to exclude specific numeric values in PostgreSQL.

Q22
Multiple Choice

Select the SQL scripts that correctly use the NOT IN operator with string values in PostgreSQL.

Q23
Multiple Choice

Determine the SQL scripts that correctly use the NOT IN operator with subqueries in PostgreSQL.

Q24
Multiple Choice

Identify the SQL scripts that correctly use the NOT IN operator with JOINs in PostgreSQL.

Q25
Multiple Choice

Select the SQL scripts that correctly use the NOT IN operator with multiple columns in PostgreSQL.

Q26
Multiple Choice

Determine the SQL scripts that correctly use the NOT IN operator with window functions in PostgreSQL.

Q27
Multiple Choice

Identify the SQL scripts that correctly use the NOT IN operator with EXISTS in PostgreSQL.

Q28
Multiple Choice

Determine the SQL scripts that correctly use the NOT IN operator with UNION in PostgreSQL.

Q29
Multiple Choice

Identify the SQL scripts that correctly use the NOT IN operator with DISTINCT in PostgreSQL.

Q30
Multiple Choice

Determine the SQL scripts that correctly use the NOT IN operator with LIMIT OFFSET in PostgreSQL.