Microsoft SQL Server Database Quiz Questions

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

The NOT IN operator is used to exclude rows that match the values in a specified list.

Q2
True / False

The NOT IN operator can be used with subqueries.

Q3
True / False

Using NOT IN with a NULL value in the list will return no rows.

Q4
True / False

The NOT IN operator can be used to filter out rows where a column value is within a range of values.

Q5
True / False

The NOT IN operator performs faster than the NOT EXISTS operator in all cases.

Q6
True / False

The NOT IN operator can be used with string values.

Q7
True / False

The NOT IN operator can be used to filter out rows with date values.

Q8
True / False

The NOT IN operator is case-sensitive by default in SQL Server.

Q9
True / False

The NOT IN operator can be combined with other logical operators such as AND and OR.

Q10
True / False

The NOT IN operator can only be used with numeric values.

Q11
True / False

When using the NOT IN operator, it is important to ensure that the subquery does not return any NULL values.

Q12
True / False

The NOT IN operator cannot be used with subqueries that return multiple columns.

Q13
True / False

The NOT IN operator can be used in an UPDATE statement to filter rows to be updated.

Q14
True / False

The NOT IN operator cannot be used with JOIN conditions.

Q15
True / False

The NOT IN operator can be used in a DELETE statement to exclude rows that match certain values.

Q16
Single Choice

Which of the following queries correctly uses the NOT IN operator to exclude rows with specific IDs?

SQL Code
SELECT *
FROM Employees
WHERE EmployeeID NOT IN (1, 2, 3);
Q17
Single Choice

How does the NOT IN operator behave when the subquery returns NULL values?

Q18
Single Choice

Which query will exclude all employees from the 'Sales' department?

SQL Code
SELECT *
FROM Employees
WHERE DepartmentID NOT IN (SELECT DepartmentID
 FROM Departments
 WHERE DepartmentName = 'Sales');
Q19
Single Choice

What will be the result of using NOT IN with an empty subquery?

Q20
Single Choice

Which query uses the NOT IN operator to exclude products from certain categories?

SQL Code
SELECT ProductName
FROM Products
WHERE CategoryID NOT IN (1, 2, 3);
Q21
Single Choice

What is the effect of using NOT IN with a list containing NULL?

Q22
Single Choice

Which of the following queries uses NOT IN to exclude rows based on a subquery?

SQL Code
SELECT EmployeeName
FROM Employees
WHERE EmployeeID NOT IN (SELECT EmployeeID
 FROM TerminatedEmployees);
Q23
Single Choice

How does the NOT IN operator affect query performance when dealing with large datasets?

Q24
Single Choice

Which query demonstrates a correct use of NOT IN to filter out specific order statuses?

SQL Code
SELECT OrderID, OrderDate
FROM Orders
WHERE OrderStatus NOT IN ('Cancelled', 'Returned');
Q25
Single Choice

Which statement about the NOT IN operator is accurate?

Q26
Single Choice

Which of the following is a valid use of the NOT IN operator?

SQL Code
SELECT CustomerName
FROM Customers
WHERE Country NOT IN ('USA', 'Canada');
Q27
Single Choice

Which query excludes products that belong to the 'Electronics' and 'Toys' categories?

SQL Code
SELECT ProductName
FROM Products
WHERE CategoryName NOT IN ('Electronics', 'Toys');
Q28
Single Choice

What does the NOT IN operator do in the following query?

SQL Code
SELECT OrderID
FROM Orders
WHERE CustomerID NOT IN (SELECT CustomerID FROM Customers WHERE Country = 'Germany');
Q29
Single Choice

Which query uses NOT IN to exclude sales from specific regions?

SQL Code
SELECT SaleID, SaleAmount
FROM Sales
WHERE RegionID NOT IN (1, 2, 3);
Q30
Single Choice

Which of the following queries excludes employees from the 'HR' and 'IT' departments?

SQL Code
SELECT EmployeeName
FROM Employees
WHERE DepartmentName NOT IN ('HR', 'IT');
Q31
Multiple Choice

Which query will exclude products from the specified categories?

SQL Code
SELECT ProductName
FROM Products
WHERE CategoryID NOT IN (SELECT CategoryID
 FROM Categories
 WHERE CategoryName IN ('Books', 'Movies'));
Q32
Multiple Choice

Which query correctly excludes employees from terminated employee IDs?

SQL Code
SELECT EmployeeName
FROM Employees
WHERE EmployeeID NOT IN (SELECT EmployeeID
 FROM TerminatedEmployees);
Q33
Multiple Choice

Which query uses the NOT IN operator to filter out customers from specific countries?

SQL Code
SELECT CustomerName
FROM Customers
WHERE Country NOT IN ('Germany', 'France', 'Japan');
Q34
Multiple Choice

Which query uses the NOT IN operator to exclude orders placed by certain customers?

SQL Code
SELECT OrderID, OrderDate
FROM Orders
WHERE CustomerID NOT IN (SELECT CustomerID
 FROM Customers
 WHERE Country = 'USA');
Q35
Multiple Choice

Which query excludes employees with IDs found in the subquery?

SQL Code
SELECT EmployeeName
FROM Employees
WHERE EmployeeID NOT IN (SELECT EmployeeID
 FROM RetiredEmployees);
Q36
Multiple Choice

Which query uses NOT IN to filter out products from specific suppliers?

SQL Code
SELECT ProductName
FROM Products
WHERE SupplierID NOT IN (SELECT SupplierID
 FROM Suppliers
 WHERE Country = 'China');
Q37
Multiple Choice

Which query excludes students with IDs found in the subquery?

SQL Code
SELECT StudentName
FROM Students
WHERE StudentID NOT IN (SELECT StudentID
 FROM GraduatedStudents);
Q38
Multiple Choice

Which query uses NOT IN to exclude products from suppliers in specific countries?

SQL Code
SELECT ProductName
FROM Products
WHERE SupplierID NOT IN (SELECT SupplierID
 FROM Suppliers
 WHERE Country IN ('USA', 'UK'));
Q39
Multiple Choice

Which query uses the NOT IN operator to exclude specific products?

SQL Code
SELECT ProductName
FROM Products
WHERE ProductID NOT IN (SELECT ProductID
 FROM DiscontinuedProducts);
Q40
Multiple Choice

Which query uses NOT IN to filter out customers from specific cities?

SQL Code
SELECT CustomerName
FROM Customers
WHERE City NOT IN ('New York', 'Los Angeles');
Q41
Multiple Choice

Which query uses the NOT IN operator to exclude specific orders?

SQL Code
SELECT OrderID, OrderDate
FROM Orders
WHERE OrderID NOT IN (SELECT OrderID
 FROM CancelledOrders);
Q42
Multiple Choice

Which query uses NOT IN to filter out students from specific grades?

SQL Code
SELECT StudentName
FROM Students
WHERE Grade NOT IN ('A', 'B');
Q43
Multiple Choice

Which query uses the NOT IN operator to exclude orders from specific customers?

SQL Code
SELECT OrderID, OrderDate
FROM Orders
WHERE CustomerID NOT IN (SELECT CustomerID
 FROM PreferredCustomers);
Q44
Multiple Choice

Which query excludes suppliers with IDs found in the subquery?

SQL Code
SELECT SupplierName
FROM Suppliers
WHERE SupplierID NOT IN (SELECT SupplierID
 FROM BannedSuppliers);
Q45
Multiple Choice

Which query uses the NOT IN operator to exclude employees from specific departments?

SQL Code
SELECT EmployeeName
FROM Employees
WHERE DepartmentID NOT IN (SELECT DepartmentID
 FROM Departments
 WHERE DepartmentName IN ('Sales', 'Marketing'));