Microsoft SQL Server Database Quiz Questions

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

The following query checks if the value 'USA' is present in the 'Country' column: SELECT * FROM Customers WHERE Country IN ('USA').

SQL Code
SELECT * FROM Customers
WHERE Country IN ('USA');
Q2
True / False

The IN operator can be used to check for multiple values in a column in a single query.

Q3
True / False

The IN operator is case-sensitive in Microsoft SQL Server.

Q4
True / False

Using the IN operator, you can check for both numeric and string values in the same column.

SQL Code
SELECT * FROM Orders
WHERE OrderID IN (10248, '10349');
Q5
True / False

The query will return rows where the 'Status' column has values 'Active' or 'Pending': SELECT * FROM Projects WHERE Status IN ('Active', 'Pending').

SQL Code
SELECT * FROM Projects
WHERE Status IN ('Active', 'Pending');
Q6
True / False

The following query returns all customers who are from either 'France' or 'Spain': SELECT * FROM Customers WHERE Country IN ('France', 'Spain').

SQL Code
SELECT * FROM Customers
WHERE Country IN ('France', 'Spain');
Q7
True / False

The IN operator can only be used with numeric values.

Q8
True / False

The IN operator improves query performance by reducing the need for multiple OR conditions.

Q9
True / False

The following query will return an error: SELECT * FROM Products WHERE CategoryID IN (1, 2, '3').

SQL Code
SELECT * FROM Products
WHERE CategoryID IN (1, 2, '3');
Q10
True / False

The IN operator can be used within a subquery to filter results based on another table's values.

SQL Code
SELECT * FROM Employees
WHERE DepartmentID IN (SELECT DepartmentID FROM Departments WHERE Location = 'New York');
Q11
True / False

The following query checks for both 'Manager' and 'Employee' roles in the 'Role' column: SELECT * FROM Users WHERE Role IN ('Manager', 'Employee').

SQL Code
SELECT * FROM Users
WHERE Role IN ('Manager', 'Employee');
Q12
True / False

The IN operator can be used in an UPDATE statement to modify multiple rows at once.

SQL Code
UPDATE Employees
SET Status = 'Active'
WHERE EmployeeID IN (101, 102, 103);
Q13
True / False

Using the IN operator in a DELETE statement can remove multiple rows from a table.

SQL Code
DELETE FROM Orders
WHERE OrderID IN (201, 202, 203);
Q14
True / False

The following query filters orders placed in the year 2020 or 2021: SELECT * FROM Orders WHERE YEAR(OrderDate) IN (2020, 2021).

SQL Code
SELECT * FROM Orders
WHERE YEAR(OrderDate) IN (2020, 2021);
Q15
True / False

The IN operator can be used with NULL values in the list.

Q16
Single Choice

Which query will correctly filter employees who belong to the 'Sales' or 'HR' department?

SQL Code
SELECT * FROM Employees
WHERE Department IN ('Sales', 'HR');
Q17
Single Choice

Which SQL query retrieves all products where the 'CategoryID' is either 1, 2, or 3?

SQL Code
SELECT * FROM Products
WHERE CategoryID IN (1, 2, 3);
Q18
Single Choice

How would you select customers from 'Germany' or 'France'?

SQL Code
SELECT * FROM Customers
WHERE Country IN ('Germany', 'France');
Q19
Single Choice

Which query checks for order dates in January, February, or March?

SQL Code
SELECT * FROM Orders
WHERE MONTH(OrderDate) IN (1, 2, 3);
Q20
Single Choice

Which query retrieves orders with a status of 'Shipped', 'Pending', or 'Cancelled'?

SQL Code
SELECT * FROM Orders
WHERE Status IN ('Shipped', 'Pending', 'Cancelled');
Q21
Single Choice

How do you find employees who have the job title 'Manager' or 'Engineer'?

SQL Code
SELECT * FROM Employees
WHERE JobTitle IN ('Manager', 'Engineer');
Q22
Single Choice

Which query will return products that are in categories 1, 4, or 5?

SQL Code
SELECT * FROM Products
WHERE CategoryID IN (1, 4, 5);
Q23
Single Choice

How do you select orders made by customers from 'UK', 'USA', or 'Canada'?

SQL Code
SELECT * FROM Orders
WHERE CustomerCountry IN ('UK', 'USA', 'Canada');
Q24
Single Choice

Which query retrieves employees who are part of 'Finance', 'Marketing', or 'IT' departments?

SQL Code
SELECT * FROM Employees
WHERE Department IN ('Finance', 'Marketing', 'IT');
Q25
Single Choice

How do you find orders where the 'OrderID' is 10, 20, or 30?

SQL Code
SELECT * FROM Orders
WHERE OrderID IN (10, 20, 30);
Q26
Single Choice

Which query retrieves products from suppliers located in 'China', 'India', or 'Brazil'?

SQL Code
SELECT * FROM Products
WHERE SupplierCountry IN ('China', 'India', 'Brazil');
Q27
Single Choice

How do you select customers whose 'City' is either 'New York', 'Los Angeles', or 'Chicago'?

SQL Code
SELECT * FROM Customers
WHERE City IN ('New York', 'Los Angeles', 'Chicago');
Q28
Single Choice

Which query checks if the 'OrderID' is in the list (1001, 1002, 1003)?

SQL Code
SELECT * FROM Orders
WHERE OrderID IN (1001, 1002, 1003);
Q29
Single Choice

How do you find suppliers located in 'USA', 'Canada', or 'Mexico'?

SQL Code
SELECT * FROM Suppliers
WHERE Country IN ('USA', 'Canada', 'Mexico');
Q30
Single Choice

Which query retrieves employees with 'JobTitle' in 'Analyst', 'Developer', or 'Consultant'?

SQL Code
SELECT * FROM Employees
WHERE JobTitle IN ('Analyst', 'Developer', 'Consultant');
Q31
Multiple Choice

Select customers from 'Spain', 'Portugal', or 'Italy' using the IN operator.

SQL Code
SELECT * FROM Customers
WHERE Country IN ('Spain', 'Portugal', 'Italy');
Q32
Multiple Choice

How do you retrieve orders with 'OrderStatus' of 'Pending', 'Approved', or 'Rejected'?

SQL Code
SELECT * FROM Orders
WHERE OrderStatus IN ('Pending', 'Approved', 'Rejected');
Q33
Multiple Choice

Which query selects products where 'ProductID' is in (101, 102, 103)?

SQL Code
SELECT * FROM Products
WHERE ProductID IN (101, 102, 103);
Q34
Multiple Choice

How do you find employees working in 'HR', 'Finance', or 'Operations' departments?

SQL Code
SELECT * FROM Employees
WHERE Department IN ('HR', 'Finance', 'Operations');
Q35
Multiple Choice

Select suppliers from 'Germany', 'France', or 'UK' using the IN operator.

SQL Code
SELECT * FROM Suppliers
WHERE Country IN ('Germany', 'France', 'UK');
Q36
Multiple Choice

Which query retrieves customers with 'CustomerID' in (501, 502, 503)?

SQL Code
SELECT * FROM Customers
WHERE CustomerID IN (501, 502, 503);
Q37
Multiple Choice

How do you select orders where 'OrderDate' is '2023-01-01', '2023-02-01', or '2023-03-01'?

SQL Code
SELECT * FROM Orders
WHERE OrderDate IN ('2023-01-01', '2023-02-01', '2023-03-01');
Q38
Multiple Choice

Which query retrieves products where 'CategoryID' is in (5, 10, 15)?

SQL Code
SELECT * FROM Products
WHERE CategoryID IN (5, 10, 15);
Q39
Multiple Choice

How do you find customers from 'Japan', 'Korea', or 'China' using the IN operator?

SQL Code
SELECT * FROM Customers
WHERE Country IN ('Japan', 'Korea', 'China');
Q40
Multiple Choice

Which query retrieves suppliers with 'SupplierID' in (201, 202, 203)?

SQL Code
SELECT * FROM Suppliers
WHERE SupplierID IN (201, 202, 203);
Q41
Multiple Choice

How do you select employees with 'EmployeeID' in (100, 200, 300)?

SQL Code
SELECT * FROM Employees
WHERE EmployeeID IN (100, 200, 300);
Q42
Multiple Choice

Which query finds orders where 'OrderAmount' is in (500, 1000, 1500)?

SQL Code
SELECT * FROM Orders
WHERE OrderAmount IN (500, 1000, 1500);
Q43
Multiple Choice

How do you retrieve products with 'ProductID' in (110, 120, 130)?

SQL Code
SELECT * FROM Products
WHERE ProductID IN (110, 120, 130);
Q44
Multiple Choice

Which query retrieves employees with 'LastName' in 'Smith', 'Jones', or 'Brown'?

SQL Code
SELECT * FROM Employees
WHERE LastName IN ('Smith', 'Jones', 'Brown');
Q45
Multiple Choice

How do you find orders where 'ShippingCity' is 'Los Angeles', 'San Francisco', or 'San Diego'?

SQL Code
SELECT * FROM Orders
WHERE ShippingCity IN ('Los Angeles', 'San Francisco', 'San Diego');