---
id: sql-select-distinct
title: "SQL Select Distinct"
category: "Database"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["SQL SELECT DISTINCT Statement", "DISTINCT keyword", "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", "distinct", "select"]
raw_sources: ["https://www.w3schools.com/sql/sql_distinct.asp"]
applied_in: []
github_commit: ""
---

# [[SQL Select Distinct]]

## 🎯 한 줄 통찰 (One-line insight)
SELECT DISTINCT returns only unique values from a column, collapsing duplicate rows that a plain SELECT would otherwise repeat. [S1]

## 🧠 핵심 개념 (Core concepts)
- **SELECT DISTINCT** — returns only distinct (unique) values, removing duplicate rows from the result. [S1]
- **Syntax** — `SELECT DISTINCT column1, column2, ... FROM table_name;`. [S1]
- **COUNT(DISTINCT column)** — counts the number of unique values in a column, but is not supported in Microsoft Access. [S1]

## 🧩 추출된 패턴 (Extracted patterns)
- **Dedup-then-count workaround** — for databases lacking `COUNT(DISTINCT ...)` (e.g. MS Access), wrap a `SELECT DISTINCT` subquery and `COUNT(*)` the outer result: `SELECT Count(*) AS DistinctCountries FROM (SELECT DISTINCT Country FROM Customers);`. [S1]

## 📖 세부 내용 (Details)
- Without DISTINCT, a query returns the column's value from every record, including repeats: `SELECT Country FROM Customers;`. [S1]
- With DISTINCT, only unique values are returned: `SELECT DISTINCT Country FROM Customers;`. [S1]
- Counting unique values directly: `SELECT COUNT(DISTINCT Country) FROM Customers;` — not supported on MS Access, which needs the subquery workaround above. [S1]

## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **DBMS 차이**: `COUNT(DISTINCT column_name)`이 MS Access에서는 지원되지 않는다는 점이 명시적으로 언급됨 — 방언별 차이가 존재. [S1]

## 🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — 이후 COUNT() 챕터에서 DISTINCT와의 조합이 더 다뤄진다. [S1]

## 💻 코드 패턴 (Code patterns)
Select unique values (SQL):
```sql
SELECT DISTINCT Country FROM Customers;
```
Count unique values, MS Access-safe (SQL):
```sql
SELECT Count(*) AS DistinctCountries
FROM (SELECT DISTINCT Country FROM Customers);
```

## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.90
- **중복 검사 결과:** 신규 생성 (New discovery)

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[SQL Tutorial]]
- **관련 개념:** [[SQL Select]], [[SQL Count]], [[SQL Group By]]
- **참조 맥락:** SELECT 결과의 중복을 제거해야 할 때 참조하는 문서 — COUNT()와 결합해 고유값 개수를 셀 때 자주 함께 쓰인다.

## 📚 출처 (Sources)
- [S1] W3Schools — SQL SELECT DISTINCT Statement — https://www.w3schools.com/sql/sql_distinct.asp

## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "SQL SELECT DISTINCT Statement" page (Astra wiki-curation, P-Reinforce v3.1 format).
