1 votes 1 votes Please help,not able to decode this query Databases databases made-easy-test-series sql + – rahul sharma 5 asked Jan 9, 2017 • edited Mar 6, 2019 by adeebafatima1 rahul sharma 5 1.1k views answer comment Share Follow See all 13 Comments See all 13 13 Comments reply Show 10 previous comments rahul sharma 5 commented Jan 10, 2017 reply Follow Share Seems to be wrongly structured. Say a person is working on any project,then innermost(3rd level) query will return pid for that . But the upper level query(2nd level) will check Not exists but as we got some pids ,so it will fail,We have and opeator ,so entire second level query will fail,and now 2nd level returned empty set,so 1st level (top most) becomes true,so if employee age is more than 30 and he is working somewhere ,then he will come in output. 2nd case:- Person is not working on any project ,then second level query will just reduced to only one check i.e(if project==database),as second check always true in this case.Now it will be persons whose age is more than 30 and there is no database project Please let me know if there is anything wrong in this approach 0 votes 0 votes Chandrabhan Vishwa 1 commented Sep 4, 2017 reply Follow Share finally answer this question 0 votes 0 votes codingo1234 commented Sep 1, 2019 reply Follow Share inner query is giving those pid who pname is "database" and the employee is not working on it and outer query checks if inner query is returns nothing i.e. if there does not exits a project whose pname is "database" and the employee is not working on it,then his/her eid is printed provided his/her age is >30 so option (a) is correct 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes not exist gives true if the inner query is empty nish kim answered Jan 19, 2018 nish kim comment Share Follow See all 0 reply Please log in or register to add a comment.