● 순위 함수 ( row_number , rank , dense_rank )
페이지 정보
작성자 관리자 작성일 23-04-14 13:19 조회 490 댓글 0본문
▣ select * from notice;
01. 정렬 관련 쿼리문
① select * from notice order by hit; --hit 칼럼 오름차순으로 정렬
② select ROWNUM num,notice.* from notice order by hit;
③ select * from (select ROWNUM num,notice.* from notice) order by hit;
④ select ROW_NUMBER() OVER (order by hit) num, notice.* from notice;
⑤ update notice set hit=44 where id=5; --조회수 변경
commit; --실행
⑥ select RANK() OVER (order by hit) num, notice.* from notice; --순위 출력 : 공동 4위 2건이니 다음은 6위
⑦ select DENSE_RANK() OVER (order by hit) num, notice.* from notice; --순위 출력 : 공동 4위 상관없이 다음은 5위
⑧ select DENSE_RANK() OVER (PARTITION by writer order by hit) num, notice.* from notice; --작성자 별 순위
추천0 비추천 0
댓글목록 0
등록된 댓글이 없습니다.