๐Ÿ’ป [SQL] 8. ์ปฌ๋Ÿผ๊ฐ’ ๋ถ„์„

thisk336ยท2023๋…„ 10์›” 5์ผ
0

SQL

๋ชฉ๋ก ๋ณด๊ธฐ
8/17
post-thumbnail

์ปฌ๋Ÿผ๊ฐ’ ๋ถ„์„

  • SQL์˜ ๋‚ด์žฅํ˜• ํ•จ์ˆ˜์ธ SUM, AVG, MAX, MIN ๋“ฑ์„ ํ™œ์šฉํ•ด ์ปฌ๋Ÿผ๊ฐ’์˜ ๋‹ค์–‘ํ•œ ๊ธฐ์ˆ  ํ†ต๊ณ„๊ฐ’์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
ํ˜•ํƒœ์„ค๋ช…
SUM([์ปฌ๋Ÿผ๋ช…])์ปฌ๋Ÿผ๊ฐ’์˜ ํ•ฉ๊ณ„ ๋ฐ˜ํ™˜
AVG([์ปฌ๋Ÿผ๋ช…])์ปฌ๋Ÿผ๊ฐ’์˜ ํ‰๊ท  ๋ฐ˜ํ™˜
MAX([์ปฌ๋Ÿผ๋ช…])์ปฌ๋Ÿผ๊ฐ’์˜ ์ตœ๋Œ€๊ฐ’ ๋ฐ˜ํ™˜
MIN([์ปฌ๋Ÿผ๋ช…])์ปฌ๋Ÿผ๊ฐ’์˜ ์ตœ์†Œ๊ฐ’ ๋ฐ˜ํ™˜
STDDEV_POP([์ปฌ๋Ÿผ๋ช…])์ปฌ๋Ÿผ๊ฐ’์˜ ๋ชจ ํ‘œ์ค€ ํŽธ์ฐจ ๋ฐ˜ํ™˜
STDDEV_SAMP([์ปฌ๋Ÿผ๋ช…]), STDDEV([์ปฌ๋Ÿผ๋ช…])์ปฌ๋Ÿผ๊ฐ’์˜ ํ‘œ๋ณธ ํ‘œ์ค€ ํŽธ์ฐจ ๋ฐ˜ํ™˜
VAR_POP([์ปฌ๋Ÿผ๋ช…])์ปฌ๋Ÿผ๊ฐ’์˜ ๋ชจ ๋ถ„์‚ฐ ๋ฐ˜ํ™˜
VAR_SAMP([์ปฌ๋Ÿผ๋ช…]), VARIANCE([์ปฌ๋Ÿผ๋ช…])์ปฌ๋Ÿผ๊ฐ’์˜ ํ‘œ๋ณธ ๋ถ„์‚ฐ ๋ฐ˜ํ™˜
SELECT * FROM test_tb;

์œ„๊ณผ ๊ฐ™์€ ํ…Œ์ด๋ธ”์ด ์žˆ์„ ๋•Œ number ์ปฌ๋Ÿผ์— ๋Œ€ํ•œ ๊ธฐ์ˆ  ํ†ต๊ณ„๊ฐ’์„ ๊ตฌํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

SELECT 
	SUM(number),
    AVG(number),
    MAX(number),
    MIN(number),
    STDDEV_POP(number),
    VAR_POP(number)
FROM test_tb;

0๊ฐœ์˜ ๋Œ“๊ธ€