inblog logo
|
gyul
    데이터 베이스

    [데이터 베이스] 10-2. 순위 구하기 rownum 변수 활용

    귤's avatar
    귤
    Feb 28, 2025
    [데이터 베이스] 10-2. 순위 구하기 
rownum 변수 활용
    Contents
    순위 구하기 (직접) 예제

    순위 구하기 (직접) 예제

    -- 3. 순위 구하기 (직접) set @rownum := 0; -- 초기화 select ename, sal, @rownum := @rownum+1 from ( -- 이거 자체를 table로 보기 select ename, sal from emp order by sal desc ) nemp;
    notion image

    초기화 안하고 하면?

    • 계속 숫자가 증가함!
    notion image
     
    Share article

    gyul

    RSS·Powered by Inblog