Q1
True / FalseIn SQL, the '>' operator is used to check if a value is greater than another value.
The '>' operator is used in SQL to compare two values and returns true if the left value is greater than the right value.
Q2
True / FalseThe '<' operator can be used to compare string values in SQL.
In SQL, the '<' operator can be used to compare string values based on their alphabetical order.
Q3
True / FalseThe '>' operator cannot be used with NULL values in SQL.
In SQL, comparisons with NULL values always result in NULL. Therefore, the '>' operator cannot be used to make meaningful comparisons with NULL values.
Q4
True / FalseThe '<' operator is used to check if a value is greater than or equal to another value.
The '<' operator is used to check if a value is less than another value. To check for greater than or equal to, the '>=' operator should be used.
Q5
True / FalseUsing the '>' operator with numeric values can result in logical errors if the values are negative.
The '>' operator correctly compares numeric values regardless of whether they are positive or negative.
Q6
True / FalseThe '>' operator is used to compare dates in SQL Server.
In SQL Server, the '>' operator can be used to compare date values to check if one date is after another.
Q7
True / FalseThe '<' operator is used to compare two numeric values in SQL Server.
In SQL Server, the '<' operator can be used to compare two numeric values to determine if one is less than the other.
Q8
True / FalseThe '>' operator can be used to filter results in a SQL query based on a condition.
The '>' operator can be used in the WHERE clause of a SQL query to filter results based on a specified condition.
Q9
True / FalseUsing '<' with string values will compare their ASCII values in SQL Server.
In SQL Server, using '<' with string values compares their ASCII values to determine their order.
Q10
True / FalseIn SQL Server, '<' can be used to compare two columns directly in the WHERE clause.
The '<' operator can be used in the WHERE clause to compare values of two columns directly in SQL Server.
Q11
True / FalseThe '>' operator will return an error if used with different data types in SQL Server.
SQL Server will attempt to implicitly convert different data types when using the '>' operator. An error occurs only if conversion fails.
Q12
True / FalseUsing '<' to compare NULL values will always return true in SQL Server.
Comparisons involving NULL values in SQL Server always return NULL, not true or false.
Q13
True / FalseThe '>' operator can be used in a JOIN condition in SQL Server.
The '>' operator can be used in the ON clause of a JOIN condition to join tables based on a greater than comparison.
Q14
True / FalseUsing '<' in the SELECT clause will cause an error in SQL Server.
The '<' operator is not valid in the SELECT clause directly. It is used in WHERE, HAVING, and JOIN conditions.
Q15
True / FalseThe '>' operator cannot be used in a subquery condition in SQL Server.
The '>' operator can be used in subquery conditions to filter results based on comparisons.
Q16
Single ChoiceWhich query retrieves employees with salaries greater than 50000?
SQL Code
SELECT EmployeeID, EmployeeName, Salary
FROM Employees
WHERE Salary > 50000;
The query uses the '>' operator to retrieve employees whose salaries are greater than 50000.
Q17
Single ChoiceWhich query retrieves products with prices less than 100?
SQL Code
SELECT ProductID, ProductName, Price
FROM Products
WHERE Price < 100;
The query uses the '<' operator to retrieve products whose prices are less than 100.
Q18
Single ChoiceWhich query retrieves orders placed before the year 2022?
SQL Code
SELECT OrderID, OrderDate, CustomerID
FROM Orders
WHERE YEAR(OrderDate) < 2022;
The query uses the '<' operator to retrieve orders placed before the year 2022.
Q19
Single ChoiceWhich query retrieves products with stock quantities greater than 50?
SQL Code
SELECT ProductID, ProductName, StockQuantity
FROM Products
WHERE StockQuantity > 50;
The query uses the '>' operator to retrieve products with stock quantities greater than 50.
Q20
Single ChoiceWhich query retrieves employees who joined the company before the year 2015?
SQL Code
SELECT EmployeeID, EmployeeName, HireDate
FROM Employees
WHERE YEAR(HireDate) < 2015;
The query uses the '<' operator to retrieve employees who joined the company before the year 2015.
Q21
Single ChoiceWhich query retrieves orders with total amounts greater than 1000?
SQL Code
SELECT OrderID, OrderDate, TotalAmount
FROM Orders
WHERE TotalAmount > 1000;
The query uses the '>' operator to retrieve orders with total amounts greater than 1000.
Q22
Single ChoiceWhich query retrieves customers with ages less than 30?
SQL Code
SELECT CustomerID, CustomerName, Age
FROM Customers
WHERE Age < 30;
The query uses the '<' operator to retrieve customers whose ages are less than 30.
Q23
Single ChoiceWhich query retrieves products with weights less than 10?
SQL Code
SELECT ProductID, ProductName, Weight
FROM Products
WHERE Weight < 10;
The query uses the '<' operator to retrieve products whose weights are less than 10.
Q24
Single ChoiceWhich query retrieves employees with performance ratings greater than 4?
SQL Code
SELECT EmployeeID, EmployeeName, PerformanceRating
FROM Employees
WHERE PerformanceRating > 4;
The query uses the '>' operator to retrieve employees whose performance ratings are greater than 4.
Q25
Single ChoiceWhich query retrieves orders placed after January 1, 2023?
SQL Code
SELECT OrderID, OrderDate, CustomerID
FROM Orders
WHERE OrderDate > '2023-01-01';
The query uses the '>' operator to retrieve orders placed after January 1, 2023.
Q26
Single ChoiceWhich query retrieves employees with ages greater than 40?
SQL Code
SELECT EmployeeID, EmployeeName, Age
FROM Employees
WHERE Age > 40;
The query uses the '>' operator to retrieve employees whose ages are greater than 40.
Q27
Single ChoiceWhich query retrieves products with quantities in stock less than 100?
SQL Code
SELECT ProductID, ProductName, QuantityInStock
FROM Products
WHERE QuantityInStock < 100;
The query uses the '<' operator to retrieve products with quantities in stock less than 100.
Q28
Single ChoiceWhich query retrieves orders with total amounts less than 200?
SQL Code
SELECT OrderID, OrderDate, TotalAmount
FROM Orders
WHERE TotalAmount < 200;
The query uses the '<' operator to retrieve orders with total amounts less than 200.
Q29
Single ChoiceWhich query retrieves customers with credit limits greater than 5000?
SQL Code
SELECT CustomerID, CustomerName, CreditLimit
FROM Customers
WHERE CreditLimit > 5000;
The query uses the '>' operator to retrieve customers whose credit limits are greater than 5000.
Q30
Single ChoiceWhich query retrieves employees with experience less than 5 years?
SQL Code
SELECT EmployeeID, EmployeeName, Experience
FROM Employees
WHERE Experience < 5;
The query uses the '<' operator to retrieve employees whose experience is less than 5 years.
Q31
Multiple ChoiceWhich of the following queries retrieve products with prices greater than 50?
SQL Code
SELECT ProductID, ProductName, Price
FROM Products
WHERE Price > 50;
The queries use the '>' operator to retrieve products whose prices are greater than 50.
Q32
Multiple ChoiceWhich of the following queries retrieve employees with performance ratings less than 3?
SQL Code
SELECT EmployeeID, EmployeeName, PerformanceRating
FROM Employees
WHERE PerformanceRating < 3;
The queries use the '<' operator to retrieve employees whose performance ratings are less than 3.
Q33
Multiple ChoiceWhich of the following queries retrieve orders with total amounts greater than 500?
SQL Code
SELECT OrderID, OrderDate, TotalAmount
FROM Orders
WHERE TotalAmount > 500;
The queries use the '>' operator to retrieve orders with total amounts greater than 500.
Q34
Multiple ChoiceWhich of the following queries retrieve customers with ages greater than 25?
SQL Code
SELECT CustomerID, CustomerName, Age
FROM Customers
WHERE Age > 25;
The queries use the '>' operator to retrieve customers whose ages are greater than 25.
Q35
Multiple ChoiceWhich of the following queries retrieve products with weights less than 20?
SQL Code
SELECT ProductID, ProductName, Weight
FROM Products
WHERE Weight < 20;
The queries use the '<' operator to retrieve products whose weights are less than 20.
Q36
Multiple ChoiceWhich of the following queries retrieve employees with experience greater than 10 years?
SQL Code
SELECT EmployeeID, EmployeeName, Experience
FROM Employees
WHERE Experience > 10;
The queries use the '>' operator to retrieve employees whose experience is greater than 10 years.
Q37
Multiple ChoiceWhich of the following queries retrieve orders placed before the year 2021?
SQL Code
SELECT OrderID, OrderDate, CustomerID
FROM Orders
WHERE YEAR(OrderDate) < 2021;
The queries use the '<' operator to retrieve orders placed before the year 2021.
Q38
Multiple ChoiceWhich of the following queries retrieve customers with credit limits less than 3000?
SQL Code
SELECT CustomerID, CustomerName, CreditLimit
FROM Customers
WHERE CreditLimit < 3000;
The queries use the '<' operator to retrieve customers whose credit limits are less than 3000.
Q39
Multiple ChoiceWhich of the following queries retrieve products with quantities in stock less than 500?
SQL Code
SELECT ProductID, ProductName, QuantityInStock
FROM Products
WHERE QuantityInStock < 500;
The queries use the '<' operator to retrieve products whose quantities in stock are less than 500.
Q40
Multiple ChoiceWhich of the following queries retrieve employees with salaries greater than 80000?
SQL Code
SELECT EmployeeID, EmployeeName, Salary
FROM Employees
WHERE Salary > 80000;
The queries use the '>' operator to retrieve employees whose salaries are greater than 80000.
Q41
Multiple ChoiceWhich of the following queries retrieve employees who have worked for the company for more than 10 years and have a salary greater than 90000?
SQL Code
SELECT EmployeeID, EmployeeName, HireDate, Salary
FROM Employees
WHERE DATEDIFF(year, HireDate, GETDATE()) > 10
AND Salary > 90000;
The queries use '>' operator to filter employees who have worked for more than 10 years and have a salary greater than 90000.
Q42
Multiple ChoiceWhich of the following queries retrieve products with prices between 200 and 800 and a stock quantity less than 100?
SQL Code
SELECT ProductID, ProductName, Price, QuantityInStock
FROM Products
WHERE Price > 200 AND Price < 800
AND QuantityInStock < 100;
The queries use '>' and '<' operators to filter products with prices between 200 and 800 and a stock quantity less than 100.
Q43
Multiple ChoiceWhich of the following queries retrieve customers who have spent more than 5000 in the last 3 years and placed less than 10 orders?
SQL Code
SELECT CustomerID, CustomerName, COUNT(OrderID) as OrderCount, SUM(TotalAmount) as TotalSpent
FROM Orders
WHERE OrderDate > DATEADD(year, -3, GETDATE())
GROUP BY CustomerID, CustomerName
HAVING SUM(TotalAmount) > 5000
AND COUNT(OrderID) < 10;
The queries use '>' and '<' operators in the HAVING clause to filter customers who have spent more than 5000 and placed less than 10 orders in the last 3 years.
Q44
Multiple ChoiceWhich of the following queries retrieve employees in the IT department with experience greater than 8 years and a salary less than 85000?
SQL Code
SELECT EmployeeID, EmployeeName, Department, DATEDIFF(year, HireDate, GETDATE()) as Experience, Salary
FROM Employees
WHERE Department = 'IT'
AND DATEDIFF(year, HireDate, GETDATE()) > 8
AND Salary < 85000;
The queries use '>' and '<' operators to filter employees in the IT department with experience greater than 8 years and a salary less than 85000.
Q45
Multiple ChoiceWhich of the following queries retrieve orders placed in the last 6 months with total amounts greater than 1500 and containing more than 5 items?
SQL Code
SELECT OrderID, OrderDate, TotalAmount, ItemCount
FROM Orders
WHERE OrderDate > DATEADD(month, -6, GETDATE())
AND TotalAmount > 1500
AND ItemCount > 5;
The queries use '>' operator to filter orders placed in the last 6 months with total amounts greater than 1500 and containing more than 5 items.