Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DongguemYoo/96f69fe5bb4fe8a7aec5cfc29f09a741 to your computer and use it in GitHub Desktop.
Save DongguemYoo/96f69fe5bb4fe8a7aec5cfc29f09a741 to your computer and use it in GitHub Desktop.
코딩테스트 여러 기준으로 정렬하기.sql
여러가지 칼럼을 order by할때는 이런식으로 처리한다(서로의 정렬 기준이 달라도 상관없음)
ssss iiii
a 300
a 200
b 100
a 400
b 500
c 600
이런 자료를
select *
from temp
order by sss asc,
iiii asc
ssss iiii
a 200
a 300
a 400
b 100
b 500
c 600
이런식으로 알아서 정렬이 된다!
#############정답#############
-- 코드를 입력하세요
SELECT ANIMAL_ID,NAME,DATETIME
from ANIMAL_INS
order by NAME asc , DATETIME desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment