● 순위 함수 ( row_number , rank , dense_rank )
페이지 정보
![profile_image](https://dancepkt.cafe24.com/data/member_image/ad/admin.gif?1630310007)
본문
▣ 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; --작성자 별 순위
- 이전글● 서브 쿼리 ( 선택 칼럼 기준 졍렬 후 페이징 처리 ) 23.04.14
- 다음글● 집계 함수 - 냉무 23.04.14
댓글목록
등록된 댓글이 없습니다.