Q1
True / FalseIn PostgreSQL, the NOT IN keyword is used to filter rows where a column's value does not match any value in a specified list.
The NOT IN keyword filters rows where the column's value is not included in the specified list of values.
Q2
True / FalseIn PostgreSQL, the NOT IN keyword can only be used with numeric values.
The NOT IN keyword can be used with numeric, text, date, and other data types.
Q3
True / FalseIn PostgreSQL, using NOT IN with an empty list will always return all rows from the table.
An empty list with NOT IN logically means no values are excluded, so all rows are returned.
Q4
True / FalseIn PostgreSQL, the NOT IN keyword is case-sensitive when used with text values.
PostgreSQL’s NOT IN keyword performs case-sensitive comparisons for text values, similar to other SQL comparisons.
Q5
True / FalseIn PostgreSQL, the NOT IN keyword can be used with subqueries to specify a dynamic list of values.
The NOT IN keyword can be used with subqueries, allowing for dynamic value lists based on the result of the subquery.
Q6
True / FalseIn PostgreSQL, using NOT IN with a subquery that returns NULL values will exclude rows where the column's value is NULL.
If a subquery used with NOT IN returns NULL, the condition will not match any rows because NULL comparisons yield unknown results.
Q7
True / FalseIn PostgreSQL, using the NOT IN keyword with a large list of values can impact query performance.
A large list of values in a NOT IN clause can degrade query performance, especially if the list is not indexed or optimized.
Q8
True / FalseIn PostgreSQL, the NOT IN keyword can be used within a JOIN condition.
The NOT IN keyword can be used within a JOIN condition to exclude rows based on a list of values.
Q9
True / FalseIn PostgreSQL, the NOT IN keyword can be combined with other logical operators like AND and OR.
The NOT IN keyword can be combined with logical operators to create complex filtering conditions.
Q10
True / FalseIn PostgreSQL, using NOT IN with a subquery that includes NULL will ensure the query returns only non-null values.
Using NOT IN with a subquery that includes NULL will cause the entire NOT IN condition to fail for all rows because NULL comparisons are treated as unknown, which results in no rows being returned.
Q11
Single ChoiceWhich 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);
The NOT IN operator filters out the employees working in departments 10, 20, or 30, returning only those who are in other departments.
Q12
Single ChoiceWhat will the following PostgreSQL query return?
SQL Code
SELECT product_name
FROM products
WHERE category_id NOT IN (1, 2, 3);
The NOT IN operator ensures that only products from categories other than 1, 2, or 3 are selected.
Q14
Single ChoiceWhat 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);
The NOT IN operator will return no rows if the column being checked contains NULLs because NULLs are not comparable using NOT IN.
Q26
Multiple ChoiceDetermine the SQL scripts that correctly use the NOT IN operator with window functions in PostgreSQL.
The NOT IN operator can be used with window functions to exclude and rank results within specific partitions. The correct scripts will demonstrate how to use the NOT IN operator with window functions in PostgreSQL.
Q28
Multiple ChoiceDetermine the SQL scripts that correctly use the NOT IN operator with UNION in PostgreSQL.
The NOT IN operator can be used with UNION to exclude and combine results from multiple tables. The correct scripts will demonstrate how to use the NOT IN operator with UNION in PostgreSQL.