retagged by
424 views
1 votes
1 votes

How will this query execute?

Q1: Select pno from project

Q2: select pno from works where employee.eno=works.eno

Now Q1 except Q2 will all projects which do not have an employee working on it. So the outer query should give: All employees who are working on some project.

But answer is: Employees working on all projects.

retagged by

1 Answer

0 votes
0 votes
Query1  selects all the PNo from project table.

Query2 is a correlated query that returns that Pno in which an employee works.

Query1 except Query2. returns in which project that particular employee did not work.

 if Query1 except Query2 is an empty set , the outer query returns the employee name.
So we can say, Query1 except Query2 is an empty set if an employee works in all project.

Related questions

1 votes
1 votes
1 answer
2
Na462 asked Jan 19, 2019
1,211 views
1 votes
1 votes
1 answer
3
Shubhanshu asked Dec 24, 2018
1,309 views
According to me it should be – “Retrieve the names of all students with a lower rank, than all students with age < 18 ”
0 votes
0 votes
1 answer
4
Na462 asked Jun 29, 2018
852 views