MySQL Database Quiz Questions

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

The MySQL "NOT IN" clause can be used to exclude records that match any value in a list of specified values.

Q2
True / False

In MySQL, the "NOT IN" clause can only be used with numerical values.

Q3
True / False

MySQL will return an empty result set if "NOT IN" is used with an empty list.

Q4
True / False

: In MySQL, "NOT IN" can be used with subqueries to filter out results from another table.

Q5
True / False

Using "NOT IN" in MySQL is generally faster than using "NOT EXISTS" for the same purpose.

Q6
True / False

MySQL's "NOT IN" clause can handle NULL values without any issues.

Q7
True / False

In MySQL, using "NOT IN" with a subquery that returns a NULL value will result in an empty result set.

Q8
True / False

In MySQL, "NOT IN" can be used in conjunction with JOIN operations to filter joined results.

Q9
True / False

Using indexes in MySQL can improve the performance of queries using the "NOT IN" clause.

Q10
True / False

In MySQL certification exams, you may be asked to optimize a query using "NOT IN" by considering alternative clauses like "NOT EXISTS" or "LEFT JOIN ... IS NULL".

Q11
Single Choice

Which of the following MySQL queries will correctly select all rows where the country column is NOT 'USA', 'Canada', or 'Mexico'?

Q12
Single Choice

What will the following MySQL query return?

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

What does this query do?

SQL Code
Consider the following SQL code:
SELECT employee_id FROM employees WHERE department_id NOT IN (5, 7, 9);
Q14
Single Choice

What will the following MySQL query return if the region_id column contains NULL values?

SQL Code
SELECT * FROM locations WHERE region_id NOT IN (2, 4, 6);
Q15
Single Choice

Which of the following queries will correctly exclude orders from customers with customer_id 101, 102, or 103?

Q16
Single Choice

What does it return?

SQL Code
Consider this SQL statement:
SELECT name FROM students WHERE grade NOT IN (SELECT grade FROM students WHERE grade < 50);
Q17
Single Choice

What will the following MySQL query return if the status column contains 'active', 'inactive', and NULL values?

SQL Code
SELECT * FROM users WHERE status NOT IN ('inactive');
Q18
Single Choice

What does it do?

SQL Code
Analyze the following query:
SELECT department_name FROM departments WHERE manager_id NOT IN (SELECT manager_id FROM employees WHERE salary > 10000);
Q19
Single Choice

What is the result?

SQL Code
Consider this complex query:
SELECT product_name FROM products WHERE product_id NOT IN (
 SELECT product_id FROM order_items WHERE quantity > 5
);
Q20
Single Choice

Which of the following MySQL queries correctly finds employees who are not assigned to the departments with department_id 10 or 20?

Q21
Multiple Choice

Which query correctly retrieves records from the 'employees' table where the 'department_id' is not in the list (1, 2, 3)?

SQL Code
SELECT *
FROM employees
WHERE department_id NOT IN (1, 2, 3);
Q22
Multiple Choice

Identify the correct SQL query that retrieves records from the 'products' table where 'category_id' is not in the list (5, 10, 15).

SQL Code
SELECT *
FROM products
WHERE category_id NOT IN (5, 10, 15);
Q23
Multiple Choice

Which query correctly selects records from the 'orders' table where the 'status' is not in ('Pending', 'Shipped', 'Delivered')?

SQL Code
SELECT *
FROM orders
WHERE status NOT IN ('Pending', 'Shipped', 'Delivered');
Q24
Multiple Choice

Determine the correct SQL query that retrieves records from the 'customers' table where 'country' is not in ('USA', 'Canada', 'Mexico').

SQL Code
SELECT *
FROM customers
WHERE country NOT IN ('USA', 'Canada', 'Mexico');
Q25
Multiple Choice

Which SQL query retrieves records from the 'inventory' table where 'item_id' is not in the list (101, 102, 103)?

SQL Code
SELECT *
FROM inventory
WHERE item_id NOT IN (101, 102, 103);
Q26
Multiple Choice

Identify the correct query that retrieves records from the 'employees' table where 'job_title' is not in ('Manager', 'Engineer', 'Analyst').

SQL Code
SELECT *
FROM employees
WHERE job_title NOT IN ('Manager', 'Engineer', 'Analyst');
Q27
Multiple Choice

Which SQL query correctly retrieves records from the 'sales' table where 'region' is not in ('North', 'South', 'East')?

SQL Code
SELECT *
FROM sales
WHERE region NOT IN ('North', 'South', 'East');
Q28
Multiple Choice

Determine the correct SQL query that selects records from the 'projects' table where 'status_id' is not in (2, 4, 6).

SQL Code
SELECT *
FROM projects
WHERE status_id NOT IN (2, 4, 6);
Q29
Multiple Choice

Which query correctly retrieves records from the 'users' table where 'role_id' is not in (1, 3, 5)?

SQL Code
SELECT *
FROM users
WHERE role_id NOT IN (1, 3, 5);
Q30
Multiple Choice

Identify the correct SQL query that retrieves records from the 'transactions' table where 'payment_method' is not in ('Credit Card', 'PayPal', 'Bank Transfer').

SQL Code
SELECT *
FROM transactions
WHERE payment_method NOT IN ('Credit Card', 'PayPal', 'Bank Transfer');