sql - What is output of this query and Why? -


declare @table table (   id int identity(1,1), salary int  )  insert @table values(1000) insert @table values(2000) insert @table values(5000) insert @table values(4000) insert @table values(1000) insert @table values(8000) insert @table values(9000) insert @table values(6000) insert @table values(1000) insert @table values(7000) insert @table values(3000)  select      a.salary       @table      (select count(*)       @table b      b.salary < a.salary) > 5 

it display salary greater 5000

enter image description here


Comments