Consider $\rm STUDENT$ table with following tuples:
SName CPI
Deepak 8.7
Dilip 9.7
Kaustav 8.5
Pallab 9.8
Sourav 8.7
Swapnil 8.5
(SELECT *
FROM STUDENT S1
WHERE 3 >= (SELECT COUNT(*)
FROM STUDENT S2
WHERE S1.CPI <= S2.CPI) )
UNION
(SELECT *
FROM STUDENT S1
WHERE S1.CPI > ALL (SELECT CPI
FROM STUDENT S2
WHERE 5 >= (SELECT COUNT(*)
FROM STUDENT S3
WHERE S2.CPI <= S3.CPI)) )
How many number of tuples are there in the output ?
I'm getting $2$ as the answer, while the given answer is $4$.