非分页中的上一篇下一篇sql语句如何写

上一页:where id=(select max(id) from examination where id < #{id} and class=#{class})

下一页:where id=(select min(id) from examination where id > #{id} and class=#{class})

<小于号,>大于号