0 votes 0 votes Databases ace-test-series sql databases + – saxena0612 asked Dec 7, 2017 • edited Mar 7, 2019 by Rishi yadav saxena0612 567 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Ashwin Kulkarni commented Dec 7, 2017 reply Follow Share Ans should be both A and B. In 1st Query inner query which is not correlated nested query hence which can run independently which captures id's of that sailors who are having green boats. By using IN outer tuple variable S will check whtere current S.sid is present in the group of inner query result or not then using "AND" it checks same for same sailor, if he has "red" boat as well or not by joining 3 tables. hence This will give names of sailors who are having both boats. In 2nd Query it simply checks intersection between set of sailors who are having "red" boats and set of sailors who are having "green" boats which will give set of sailors who are having both boats. 0 votes 0 votes saxena0612 commented Dec 7, 2017 reply Follow Share Yes answer given is both but in first query inner part : Isn`t the where clause is wrong : It should be : S2.id=R2.id and R2.bid=B2.bid or you assumed it as "typo". 0 votes 0 votes Please log in or register to add a comment.