SELECT *
FROM classes
WHERE title 
LIKE '%年级%' 
AND id<6 
OR id>7
ORDER BY id DESC

DESC降序 ASC升序

MySQL ORDER BY 排序-Qui-Note