Consider the query given below SELECT first_name, last_name, salary, commission_pct FROM employees WHERE salary < ANY (SELECT salary FROM employees WHERE department_id = 100)What will be the outcome of the query given above if the < ANY operator is replaced with = ANY operator, if we assume that the department 100 has more employees? It will treat each value of the salary returned from the sub-query as it does with IN operatorThere will be no difference in the resultsThe results will differThe execution will thrown an SQL error
Question
Consider the query given below SELECT first_name, last_name, salary, commission_pct FROM employees WHERE salary < ANY (SELECT salary FROM employees WHERE department_id = 100)What will be the outcome of the query given above if the < ANY operator is replaced with = ANY operator, if we assume that the department 100 has more employees? It will treat each value of the salary returned from the sub-query as it does with IN operatorThere will be no difference in the resultsThe results will differThe execution will thrown an SQL error
Solution
The results will differ. When you replace '< ANY' with '= ANY', the query will return the employees whose salary is equal to any salary in department 100, instead of less than any salary in department 100. So, the results will definitely differ.
Similar Questions
Consider the table Employee given below: EmpId EmpName Salary DeptId200 Alex 30000 100201 Tom 20000 101202 Dick 40000 100202 Harry 15000 102205 Mary 50000 101206 Karl 40000 101SELECT EmpName FROM Employee WHERE Salary > ALL (SELECT Salary FROM Employee WHERE DeptId = 100);What will be the outcome of the query given above?
What is true about the ANY operator used for sub-queries?Returns rows that match all the values in a list/sub-queryReturns rows that match the first 5 values in a list/sub-queryReturns rows that match any value in a list/sub-queryReturns the value 0 when all the rows match in a list/sub-query
Consider the table EMPLOYEE(empId, name, department, salary) and the two queries Q1 ,Q2 below. Assuming that department D5 has more than one employee, and we want to find the employees who get higher salary than anyone in department D5, which one of the statements is TRUE for any arbitrary employee table?Q1 : SELECT e.empId FROM employee e WHERE NOT EXIST (SELECT * From employee s where s.department = “D5” AND s.salary >=e.salary)Q2 : SELECT e.empIdFROM employee eWHERE e.salary > Any (Select distinct salary From employee s Where s.department = “D5”)Q1 is the correct queryQ2 is the correct queryBoth Q1 and Q2 produce the same answer.Neither Q1 nor Q2 is the correct query
Select ID, name, dept name, salary * 1.1 where instructor;The query given below will not give an error. Which one of the following has to be replaced to get the desired output?*Salary*1.1IDWhereInstructor
Which of the following SQL statement(s) return an error (s)?SELECT NULL FROM Customer;SELECT NAME FROM Customer WHERE SALARY = NULL;SELECT NAME FROM Customer;SELECT ALL FROM Customer WHERE SALARY = NULL;SELECT NAME,NIC FROM Customer;
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.