Computer Sciences > GATE 2014 SET-3 > SQL
Consider the following relational schema:
employee (empId, empName, empDept)
customer (custId, custName, salesRepId, rating)
salesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return?
SELECT empName
FROM employee E
WHERE NOT EXISTS
(SELECT custId
FROM customer C
WHERE C.salesRepId = E.empId
AND C.rating <> 'GOOD');
employee (empId, empName, empDept)
customer (custId, custName, salesRepId, rating)
salesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return?
SELECT empName
FROM employee E
WHERE NOT EXISTS
(SELECT custId
FROM customer C
WHERE C.salesRepId = E.empId
AND C.rating <> 'GOOD');
Correct : d
Similar Questions
Consider the following database tables of a sports league.
An instance of the table and an SQL query are given.
The value returned by the given SQL query...
Consider the following database tables of a sports league.
An instance of the table and an SQL query are given.
The value returned by the given SQL query...
Consider the following database tables of a sports league.
An instance of the table and an SQL query are given.
The value returned by the given SQL query...
Total Unique Visitors
Loading......