Q1
True / FalseThe 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');
The query correctly checks if 'USA' is in the 'Country' column of the 'Customers' table.
Q2
True / FalseThe IN operator can be used to check for multiple values in a column in a single query.
The IN operator is used to specify multiple values in a WHERE clause.
Q3
True / FalseThe IN operator is case-sensitive in Microsoft SQL Server.
The IN operator is case-sensitive depending on the collation of the column.
Q4
True / FalseUsing 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');
The IN operator can be used with both numeric and string values, but not in the same column for the same query.
Q5
True / FalseThe 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');
The query correctly uses the IN operator to filter rows where the 'Status' is either 'Active' or 'Pending'.
Q6
True / FalseThe 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');
The query correctly uses the IN operator to filter customers from 'France' or 'Spain'.
Q7
True / FalseThe IN operator can only be used with numeric values.
The IN operator can be used with both numeric and string values.
Q8
True / FalseThe IN operator improves query performance by reducing the need for multiple OR conditions.
The IN operator is more efficient than using multiple OR conditions as it simplifies the query.
Q9
True / FalseThe 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');
The IN operator cannot mix data types in the same list.
Q10
True / FalseThe 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');
The IN operator is commonly used with subqueries to filter results based on values from another table.
Q11
True / FalseThe 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');
The query uses the IN operator to filter users with roles 'Manager' or 'Employee'.
Q12
True / FalseThe 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);
The IN operator is useful in UPDATE statements to apply changes to multiple rows based on a list of values.
Q13
True / FalseUsing 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);
The IN operator is effective in DELETE statements to remove multiple rows based on specified values.
Q14
True / FalseThe 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);
The query correctly uses the IN operator to filter orders placed in the specified years.
Q15
True / FalseThe IN operator can be used with NULL values in the list.
The IN operator cannot be used with NULL values directly; it will not match NULLs.
Q17
Single ChoiceWhich 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);
The query uses the IN operator to filter products with 'CategoryID' 1, 2, or 3.
Q19
Single ChoiceWhich query checks for order dates in January, February, or March?
SQL Code
SELECT * FROM Orders
WHERE MONTH(OrderDate) IN (1, 2, 3);
The query uses the IN operator to filter orders placed in January, February, or March.
Q22
Single ChoiceWhich query will return products that are in categories 1, 4, or 5?
SQL Code
SELECT * FROM Products
WHERE CategoryID IN (1, 4, 5);
The query uses the IN operator to filter products in categories 1, 4, or 5.
Q25
Single ChoiceHow do you find orders where the 'OrderID' is 10, 20, or 30?
SQL Code
SELECT * FROM Orders
WHERE OrderID IN (10, 20, 30);
The IN operator filters orders with 'OrderID' 10, 20, or 30.
Q26
Single ChoiceWhich query retrieves products from suppliers located in 'China', 'India', or 'Brazil'?
SQL Code
SELECT * FROM Products
WHERE SupplierCountry IN ('China', 'India', 'Brazil');
The query uses the IN operator to filter products from suppliers in 'China', 'India', or 'Brazil'.
Q27
Single ChoiceHow 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');
The IN operator filters customers whose 'City' is 'New York', 'Los Angeles', or 'Chicago'.
Q28
Single ChoiceWhich query checks if the 'OrderID' is in the list (1001, 1002, 1003)?
SQL Code
SELECT * FROM Orders
WHERE OrderID IN (1001, 1002, 1003);
The IN operator filters orders where 'OrderID' is 1001, 1002, or 1003.
Q29
Single ChoiceHow do you find suppliers located in 'USA', 'Canada', or 'Mexico'?
SQL Code
SELECT * FROM Suppliers
WHERE Country IN ('USA', 'Canada', 'Mexico');
The IN operator filters suppliers located in 'USA', 'Canada', or 'Mexico'.
Q30
Single ChoiceWhich query retrieves employees with 'JobTitle' in 'Analyst', 'Developer', or 'Consultant'?
SQL Code
SELECT * FROM Employees
WHERE JobTitle IN ('Analyst', 'Developer', 'Consultant');
The IN operator is used to filter employees with 'JobTitle' in 'Analyst', 'Developer', or 'Consultant'.
Q33
Multiple ChoiceWhich query selects products where 'ProductID' is in (101, 102, 103)?
SQL Code
SELECT * FROM Products
WHERE ProductID IN (101, 102, 103);
The IN operator filters products with 'ProductID' 101, 102, or 103.
Q34
Multiple ChoiceHow do you find employees working in 'HR', 'Finance', or 'Operations' departments?
SQL Code
SELECT * FROM Employees
WHERE Department IN ('HR', 'Finance', 'Operations');
The IN operator filters employees working in 'HR', 'Finance', or 'Operations' departments.
Q36
Multiple ChoiceWhich query retrieves customers with 'CustomerID' in (501, 502, 503)?
SQL Code
SELECT * FROM Customers
WHERE CustomerID IN (501, 502, 503);
The IN operator filters customers with 'CustomerID' 501, 502, or 503.
Q37
Multiple ChoiceHow 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');
The IN operator filters orders where 'OrderDate' is '2023-01-01', '2023-02-01', or '2023-03-01'.
Q38
Multiple ChoiceWhich query retrieves products where 'CategoryID' is in (5, 10, 15)?
SQL Code
SELECT * FROM Products
WHERE CategoryID IN (5, 10, 15);
The IN operator filters products where 'CategoryID' is 5, 10, or 15.
Q39
Multiple ChoiceHow do you find customers from 'Japan', 'Korea', or 'China' using the IN operator?
SQL Code
SELECT * FROM Customers
WHERE Country IN ('Japan', 'Korea', 'China');
The IN operator filters customers from 'Japan', 'Korea', or 'China'.
Q40
Multiple ChoiceWhich query retrieves suppliers with 'SupplierID' in (201, 202, 203)?
SQL Code
SELECT * FROM Suppliers
WHERE SupplierID IN (201, 202, 203);
The IN operator filters suppliers with 'SupplierID' 201, 202, or 203.
Q41
Multiple ChoiceHow do you select employees with 'EmployeeID' in (100, 200, 300)?
SQL Code
SELECT * FROM Employees
WHERE EmployeeID IN (100, 200, 300);
The IN operator filters employees with 'EmployeeID' 100, 200, or 300.
Q42
Multiple ChoiceWhich query finds orders where 'OrderAmount' is in (500, 1000, 1500)?
SQL Code
SELECT * FROM Orders
WHERE OrderAmount IN (500, 1000, 1500);
The IN operator filters orders where 'OrderAmount' is 500, 1000, or 1500.
Q43
Multiple ChoiceHow do you retrieve products with 'ProductID' in (110, 120, 130)?
SQL Code
SELECT * FROM Products
WHERE ProductID IN (110, 120, 130);
The IN operator filters products where 'ProductID' is 110, 120, or 130.
Q44
Multiple ChoiceWhich query retrieves employees with 'LastName' in 'Smith', 'Jones', or 'Brown'?
SQL Code
SELECT * FROM Employees
WHERE LastName IN ('Smith', 'Jones', 'Brown');
The IN operator filters employees with 'LastName' 'Smith', 'Jones', or 'Brown'.
Q45
Multiple ChoiceHow 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');
The IN operator filters orders where 'ShippingCity' is 'Los Angeles', 'San Francisco', or 'San Diego'.