집계 함수와 윈도우 함수

2024. 3. 3. 10:23DBMS/SQLQuery

반응형
SELECT COUNT(ENAME) FROM EMP;

This Query aggregate the count of data in the ENAME column of the EMP table.

The result is single value representing the total count of data in the ENAME column of the EMP table.

 

 

이 쿼리는 EMP 테이블의 ENAME 열에 있는 데이터의 수를 집계한다. 그래서 결과 행은 하나, 단일 값으로, EMP 테이블의 ENAME 열에 있는 데이터의 총 수를 나타낸다.

 

 

 

SELECT COUNT(ENAME) OVER () AS EC FROM EMP;

 

This query calculates the count of data in the ENAME column each row. 

The result is returned for each row, where each row has the same count value fo the ENAME column.

Since the  OVER()function is used as a window function, it applies to all rows. Therefore, the value in the EC column is the same as the count of data in the ENAME column.

 

 윈도우 함수는 열의 데이터 수를 모든 행에 대해 계산한다. 그래서 결과는 각 행에 대해 ENAME 열의 데이터 수를 반환하며, 모든 행에 동일한 값을 갖는다.

 
반응형

'DBMS > SQLQuery' 카테고리의 다른 글

IFNULL , NVL  (0) 2024.03.03
RATIO_TO_REPORT, 파티션 별 합계에서 차지하는 비율  (0) 2024.03.03
NVL NVL2  (0) 2024.02.24
행 제한절 FETCH FIRST OFFSET  (0) 2024.01.02
sql 몬테카를로 알고리즘  (0) 2023.12.31