Asymptotic-Complexity
May 4, 2024Database-Management-System
May 4, 2024GATE 2014 [Set-3]
|
Question 64
|
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`);
|
Names of all the employees with at least one of their customers having a ‘GOOD’ rating.
|
|
|
Names of all the employees with at most one of their customers having a ‘GOOD’ rating.
|
|
|
Names of all the employees with none of their customers having a ‘GOOD’ rating.
|
|
|
Names of all the employees with all their customers having a ‘GOOD’ rating.
|
Question 64 Explanation:
The inner query i.e., ② represents all customers having other than ‘GOOD’ while the entire query represents name of all employees with all their customers having a ‘good rating’.
Correct Answer: D
Question 64 Explanation:
The inner query i.e., ② represents all customers having other than ‘GOOD’ while the entire query represents name of all employees with all their customers having a ‘good rating’.
![GATE 2014 [Set-3]](https://solutionsadda.in/wp-content/uploads/2019/05/green-new-logo.png)