--- id: sql-wildcards title: "SQL Wildcards" category: "Database" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["SQL Wildcard Characters", "SQL 와일드카드"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.88 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["sql", "database", "w3schools", "wildcards", "like"] raw_sources: ["https://www.w3schools.com/sql/sql_wildcards.asp"] applied_in: [] github_commit: "" --- # [[SQL Wildcards]] ## 🎯 한 줄 통찰 (One-line insight) Beyond `%` and `_`, standard SQL wildcards include `[]` (character set), `-` (range within brackets), and `^`/`!` (negated set) — but support for these varies significantly by database vendor. [S1] ## 🧠 핵심 개념 (Core concepts) - **Wildcard character** — substitutes one or more characters in a string pattern, used together with the LIKE operator. [S1] - **`%`** — zero or more characters. **`_`** — exactly one character. [S1] - **`[]`** — matches any single character within the brackets, e.g. `[bsp]` matches "b", "s", or "p". [S1] - **`-`** — specifies a character range inside `[]`, e.g. `[a-f]`. [S1] - **`^`** — matches any character NOT in the brackets (vendor-specific). [S1] - **`{}`** — matches any escaped character (Oracle only). [S1] ## 🧩 추출된 패턴 (Extracted patterns) - **Vendor fragmentation** — `[]`/`^`/`-` are NOT supported in PostgreSQL and MySQL; `{}` is Oracle-only; MS Access uses an entirely different wildcard set (`*` instead of `%`, `?` instead of `_`, `!` instead of `^`, `#` for a single digit). [S1] - **Combinable wildcards** — `%` and `_` can be freely combined in one pattern (e.g. `'a__%'`). [S1] ## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria) | 항목 (Option) | 장점 | 단점 | 언제 선택 | |---|---|---|---| | **표준 SQL 와일드카드 (`%`, `_`)** | PostgreSQL/MySQL/SQL Server 등 대부분 지원 | 문자 집합/범위 표현 불가 | 이식성이 중요한 경우 | | **`[]`/`-`/`^` 확장 와일드카드** | 문자 집합·범위·부정을 한 패턴에 표현 가능 | PostgreSQL/MySQL 미지원 | SQL Server/Access 등 지원 DB 한정 | | **MS Access 전용 와일드카드 (`*`,`?`,`#`,`!`)** | Access 네이티브 문법과 일치 | 다른 DB로 이식 불가 | MS Access 전용 쿼리 작성 시 | ## 📖 세부 내용 (Details) - Character set match: `WHERE CustomerName LIKE '[bsp]%';` (starts with b, s, or p). [S1] - Range match: `WHERE CustomerName LIKE '[a-f]%';` (starts with a through f). [S1] - Combine `%` and `_`: `WHERE CustomerName LIKE 'a__%';` (starts with "a", at least 3 characters). [S1] - MS Access wildcard table — `*` (zero+ chars), `?` (single char), `[]` (char set), `!` (negated set), `-` (range), `#` (single digit), e.g. `h[oa]t` finds "hot"/"hat" but not "hit". [S1] ## ⚖️ 모순 및 업데이트 (Contradictions & updates) - **DB별 지원 차이가 소스 자체의 핵심 메시지**: `[]`,`^`,`-`는 PostgreSQL/MySQL 미지원, `{}`는 Oracle 전용, MS Access는 아예 다른 기호 체계(`*`,`?`,`#`,`!`)를 사용 — 하나의 "SQL 와일드카드" 표준이 사실상 존재하지 않음을 소스가 명시. [S1] ## 🛠️ 적용 사례 (Applied in summary) 현재 발견된 실제 적용 사례가 없습니다 — SQL Like 챕터에서 소개된 `%`/`_`가 여기서 DB별 확장 와일드카드로 심화된다. [S1] ## 💻 코드 패턴 (Code patterns) Character-set and range wildcards (SQL, non-MySQL/PostgreSQL): ```sql SELECT * FROM Customers WHERE CustomerName LIKE '[bsp]%'; SELECT * FROM Customers WHERE CustomerName LIKE '[a-f]%'; ``` MS Access equivalent: ``` h[oa]t -- finds "hot" and "hat", but not "hit" ``` ## ✅ 검증 상태 및 신뢰도 - **상태:** draft - **검증 단계:** conceptual - **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body) - **신뢰 점수:** 0.88 - **중복 검사 결과:** 신규 생성 (New discovery) ## 🔗 지식 그래프 (Knowledge Graph) - **상위/루트:** [[SQL Tutorial]] - **관련 개념:** [[SQL Like]], [[SQL Where]] - **참조 맥락:** LIKE 패턴 매칭을 문자 집합/범위 수준으로 확장할 때 참조 — 단, DB 벤더별 지원 여부를 먼저 확인해야 한다. ## 📚 출처 (Sources) - [S1] W3Schools — SQL Wildcards — https://www.w3schools.com/sql/sql_wildcards.asp ## 📝 변경 이력 (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "SQL Wildcards" page (Astra wiki-curation, P-Reinforce v3.1 format).