Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLcorrelated subqueriesSingle-choice MCQ

What is the result of this correlated subquery for the row where outer.id = 2, given the data below?

-- o(id, dept, salary): (1,'A',100),(2,'A',200),(3,'B',150) SELECT id, (SELECT COUNT(*) FROM o i WHERE i.dept = o.dept AND i.salary > o.salary) AS higher_in_dept FROM o;