order by는 where과 같은 상위 조건부 라고 생각하면 편하다.
사용할때 주의할 점은 order by 같은경우 거의 하단에 선언해야 사용 할 수있다는 점을 알고 있으면 좋을거 같다!
-- 데이터 정렬 방법 order by 키워드
-- order by
select author_lname
from books
order by author_lname asc; -- 오름차순으로 정렬
select author_lname
from books
order by author_lname desc; -- 내림차순으로 정렬