edited by
796 views
0 votes
0 votes

 

The number of rows returned by sql query on given relation:

SELECT * from emp where eno NOT IN (SELECT manager from emp)

Query intends to find the number of employees who are not MANAGER so emp 2,3,4 are ruled out. But since it includes comparison with NULL so it will be executed like this for emp 1,

1 NOT IN {2,3,4,NULL}

I thought it in opposite way,

1 IN {2,3,4,NULL} will return false. So NOT IN will give true and number of rows returned will be 1.

Answer given is 0. Please clarify.

edited by

Please log in or register to answer this question.

Related questions

1 votes
1 votes
0 answers
1
–1 votes
–1 votes
0 answers
2
Himanshu Kashyap asked Jan 12, 2019
676 views
PLEASE EXPLAIN WHEATHER IT WOULD BE SOME EC DEPARMENT OR ALL EC DEPARTMENT I THINK ALL BECOZ IT IS SELECTION EID OF STUDENT WHO HAVE NOT ENROLLED IN ANY COURSE OF EC
1 votes
1 votes
0 answers
3
1 votes
1 votes
0 answers
4