• Daum
  • |
  • 카페
  • |
  • 테이블
  • |
  • 메일
  • |
  • 카페앱 설치
 
카페정보
데이터관련 교육 카페
 
 
 
카페 게시글
1.SQL 613제 Re: 오늘의 마지막 문제: 상호명에 떡볶이를 포함하고 있는 떡볶이 프랜차이즈 상호명과 매장수를 다음과 같이 출력하시오!
17기_김정명 추천 0 조회 57 23.06.27 17:09 댓글 3
게시글 본문내용
 
다음검색
댓글
  • 작성자 23.06.28 13:34

    첫댓글 SELECT ename, sal,
    RANK() OVER(ORDER BY sal DESC) AS rank순위,
    round(RANK() OVER (ORDER BY sal DESC) / 14,2) AS rank비율,
    DENSE_RANK() OVER(ORDER BY sal DESC) AS dense순위,
    round(DENSE_RANK() OVER (ORDER BY sal DESC) / 14,2) AS dense비율,
    round(CUME_DIST() OVER (ORDER BY sal DESC),2) AS cume순위비율
    FROM emp;

  • 23.06.28 13:48

    SELECT ename, sal,
    RANK() OVER(ORDER BY sal DESC) AS rank순위,
    round(RANK() OVER (ORDER BY sal DESC) / 14,2) AS rank비율,
    DENSE_RANK() OVER(ORDER BY sal DESC) AS dense순위,
    round(DENSE_RANK() OVER (ORDER BY sal DESC) / 14,2) AS dense비율,
    round(CUME_DIST() OVER (ORDER BY sal DESC),2) AS cume순위비율,
    round(sum(sal) over (order by sal desc) / sum(sal) over (), 2) ,
    sum(sal) over (order by sal desc) ,
    sum(sal) over ()

    FROM emp;


  • 23.06.28 14:38


    SELECT ename, sal,
    ROUND((SELECT COUNT(*) FROM emp e2 WHERE e2.sal >= e1.sal) / (SELECT COUNT(*) FROM emp), 2) AS cume순위비율,
    ROUND(CUME_DIST() OVER (ORDER BY sal DESC), 2) AS cume순위비율
    FROM emp e1
    ORDER BY sal DESC;

최신목록