The GATE Grind

GATE 2007 CS – Question 61

Databases · Relational Model: Relational Algebra, Tuple Calculus, SQL · 2 marks · Multiple choice

employee(empId, name, department, salary) has more than one employee in department5. We want employees paid more than anyone in department5. Which is TRUE for an arbitrary 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');
  1. Q1 is correct.
  2. Q2 is correct.
  3. Both give the same answer.
  4. Neither is correct.

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (A) Q1 is correct.

Explanation

We are sorry we couldn't write detailed soluition for this, we are working on it!, please consider asking your own AI, its just 2-3 clicks with very minimum effort

More Relational Model: Relational Algebra, Tuple Calculus, SQL questions

All Relational Model: Relational Algebra, Tuple Calculus, SQL questions →