order by id DESC和order by id ASC
是字段id,降序和升序,DESC是從大到小,ASC是從小到大
這個語句的意思是
先查詢books表一共的記錄數select count(*)from books,比如得出的結果是a
然后根據id的降序查詢出前a-2條記錄的id。(select top((select count(*)from books)-2) id from books order by id DESC)
然后在這個范圍內根據id的升序查詢title,author,publishdate,isbn,unitprice字段,這個表的前兩條記錄,條件是ID在前面的范圍之內。