...
SQL
October 4, 2023
SQL
October 4, 2023
SQL
October 4, 2023
SQL
October 4, 2023

SQL

Question 33

Consider the table employee(empId, name, department, salary) and the two queries Q1,Q2 below. Assuming that department 5 has more than one employee, and we want to find the employees who get higher salary than anyone in the department 5, which one of the statements is TRUE for any arbitrary employee table?

Q1 : Select e.empId
     From employee e
     Where not exists
        (Select * From employee s where s.department = “5” and s.salary >= e.salary)
Q2 : Select e.empId
     From employee e
     Where e.salary > Any
       (Select distinct salary From employee s Where s.department = “5”)
A
Q1 is the correct query
B
Q2 is the correct query
C
Both Q1 and Q2 produce the same answer
D
Neither Q1 nor Q2 is the correct query
Question 33 Explanation: 
The required output is find the employees who get higher salary than anyone in the department “5”.
Query 1: Results the empId’s which have higher salary than anyone in the department 5.
Query 2: Results the empId’s which have higher salary than atleast one employee of department 5.
Correct Answer: A
Question 33 Explanation: 
The required output is find the employees who get higher salary than anyone in the department “5”.
Query 1: Results the empId’s which have higher salary than anyone in the department 5.
Query 2: Results the empId’s which have higher salary than atleast one employee of department 5.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!