--- id: sql-like title: "SQL Like" category: "Database" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["SQL LIKE Operator", "LIKE operator", "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", "like", "pattern-matching", "where"] raw_sources: ["https://www.w3schools.com/sql/sql_like.asp"] applied_in: [] github_commit: "" --- # [[SQL Like]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) LIKE searches for a text pattern in a column using the `%` (any characters) and `_` (single character) wildcards, and can express starts-with/ends-with/contains matching. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **LIKE operator** β€” used in a WHERE clause to search for a specified pattern within a column's text data. [S1] - **Syntax** β€” `SELECT ... FROM table_name WHERE columnN LIKE pattern;`. [S1] - **`%` wildcard** β€” represents zero, one, or multiple characters. [S1] - **`_` wildcard** β€” represents exactly one character. [S1] - **No wildcard** β€” without a wildcard, LIKE requires an exact match. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Positional-% recipe** β€” `pattern%` = starts with, `%pattern` = ends with, `%pattern%` = contains, `pattern` (no `%`) = exact match. [S1] - **Combine with AND/OR** β€” multiple LIKE conditions can be combined, e.g. `CustomerName LIKE 'a%' OR CustomerName LIKE 'b%'`. [S1] - **Wildcard stacking** β€” `%` and `_` can be combined in one pattern, e.g. `'a__%'` (starts with "a", at least 3 chars) or `'_r%'` ("r" in second position). [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Starts with: `WHERE CustomerName LIKE 'a%';`. [S1] - Contains: `WHERE city LIKE '%on%';`. [S1] - Single-character wildcard: `WHERE city LIKE 'l_nd__';` (l + 1 wildcard char + "nd" + 2 wildcard chars). [S1] - Ends with: `WHERE CustomerName LIKE '%a';`. [S1] - Starts-and-ends: `WHERE CustomerName LIKE 'b%s';`. [S1] - Exact match (no wildcard): `WHERE Country LIKE 'Spain';`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” λ‹€μŒ 챕터인 SQL Wildcardsμ—μ„œ `[]`, `-`, `^` 같은 μΆ”κ°€ μ™€μΌλ“œμΉ΄λ“œ 문법이 ν™•μž₯λœλ‹€. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Starts-with / contains / ends-with (SQL): ```sql SELECT * FROM Customers WHERE CustomerName LIKE 'a%'; -- starts with SELECT * FROM Customers WHERE city LIKE '%on%'; -- contains SELECT * FROM Customers WHERE CustomerName LIKE '%a'; -- ends with ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[SQL Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[SQL Where]], [[SQL Wildcards]], [[SQL Not]] - **μ°Έμ‘° λ§₯락:** ν…μŠ€νŠΈ νŒ¨ν„΄ 맀칭이 ν•„μš”ν•œ λͺ¨λ“  검색 쿼리의 기반 문법 β€” λ‹€μŒ 챕터 Wildcardsμ—μ„œ 문법이 ν™•μž₯λœλ‹€. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” SQL LIKE Operator β€” https://www.w3schools.com/sql/sql_like.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "SQL LIKE Operator" page (Astra wiki-curation, P-Reinforce v3.1 format).