An interview question:
write SQL Server query to return 30th to 40th record of a table A
my answer:
select top 10 * from (select top 40 * from tb desc) asc
select top 40 * from A where id not in(select top 30 id from A)
which of above 2 is more efficient? why?
Don’t use either of those, you can select those rows 30-40 somewhat more directly
See: Row Offset in SQL Server