--- id: sql-aggregate-functions title: "SQL Aggregate Functions" category: "Database" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["Aggregate functions", "SQL 집계 ν•¨μˆ˜"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.9 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["sql", "database", "w3schools", "aggregate", "groupby"] raw_sources: ["https://www.w3schools.com/sql/sql_aggregate_functions.asp"] applied_in: [] github_commit: "" --- # [[SQL Aggregate Functions]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) An aggregate function reduces a set of values to a single value, most often per GROUP BY group, and by convention ignores NULLs (except COUNT(*)). [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Aggregate function** β€” performs a calculation on a set of values and returns a single value. [S1] - **Common aggregate functions** β€” `MIN()` (smallest value), `MAX()` (largest value), `COUNT()` (row count), `SUM()` (total), `AVG()` (average). [S1] - **Pairs with GROUP BY** β€” GROUP BY splits the result-set into groups, and the aggregate function returns one value per group. [S1] - **NULL handling** β€” aggregate functions ignore NULL values, except `COUNT(*)`. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **NULL-exclusion is the default, COUNT(\*) is the exception** β€” every aggregate function silently skips NULLs, but `COUNT(*)` counts rows regardless of NULL content β€” a distinction worth remembering to avoid miscounted results. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) 이 λ¬Έμ„œλŠ” 개둠 νŽ˜μ΄μ§€λ‘œ, 각 ν•¨μˆ˜(MIN/MAX/COUNT/SUM/AVG)λŠ” μ΄μ–΄μ§€λŠ” κ°œλ³„ μ±•ν„°μ—μ„œ 문법과 μ˜ˆμ œκ°€ μƒμ„Ένžˆ 닀뀄진닀. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” 이 개둠 뒀에 MIN/MAX/COUNT/SUM/AVG 각각의 μ „μš© 챕터가 이어진닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) μ†ŒμŠ€μ— μ½”λ“œ μ˜ˆμ‹œ μ—†μŒ (개둠 νŽ˜μ΄μ§€, 각 ν•¨μˆ˜ μ±•ν„°μ—μ„œ μ½”λ“œ 제곡). ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[SQL Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[SQL Min]], [[SQL Max]], [[SQL Count]], [[SQL Sum]], [[SQL Avg]], [[SQL Group By]] - **μ°Έμ‘° λ§₯락:** MIN/MAX/COUNT/SUM/AVG λ‹€μ„― ν•¨μˆ˜ μ±•ν„°μ˜ μƒμœ„ 개둠 λ¬Έμ„œ. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” SQL Aggregate Functions β€” https://www.w3schools.com/sql/sql_aggregate_functions.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "SQL Aggregate Functions" page (Astra wiki-curation, P-Reinforce v3.1 format).