--- id: sql-null-values title: "SQL Null Values" category: "Database" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["NULL values", "IS NULL", "IS NOT NULL", "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", "null"] raw_sources: ["https://www.w3schools.com/sql/sql_null_values.asp"] applied_in: [] github_commit: "" --- # [[SQL Null Values]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) NULL represents an unknown or absent value β€” distinct from zero or an empty string β€” and can only be tested with IS NULL / IS NOT NULL, never with `=`, `<`, or `<>`. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **NULL value** β€” represents unknown, missing, or inapplicable data; a placeholder for absence of data, not a value itself. [S1] - **NULL β‰  0 or ''** β€” a NULL field is one left blank at record creation, distinct from zero or an empty string. [S1] - **Comparison operators don't work on NULL** β€” `=`, `<`, `<>` cannot test for NULL; use `IS NULL` / `IS NOT NULL` instead. [S1] - **Syntax** β€” `SELECT column_names FROM table_name WHERE column_name IS NULL;` and the `IS NOT NULL` counterpart. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Dedicated NULL-test operators** β€” because ordinary comparison operators silently fail to match NULL, SQL provides `IS NULL`/`IS NOT NULL` as the only reliable test β€” a common footgun for beginners who try `WHERE column = NULL`. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Find rows with a NULL field: `SELECT CustomerName, ContactName, Address FROM Customers WHERE Address IS NULL;`. [S1] - Find rows with a non-NULL field: `SELECT CustomerName, ContactName, Address FROM Customers WHERE Address IS NOT NULL;`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” LEFT JOIN의 anti-join νŒ¨ν„΄(`WHERE Orders.CustomerID IS NULL`)μ—μ„œ 이미 이 문법이 μ„ ν–‰ μ‚¬μš©λ˜μ—ˆλ‹€. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Test for NULL / NOT NULL (SQL): ```sql SELECT CustomerName, ContactName, Address FROM Customers WHERE Address IS NULL; ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[SQL Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[SQL Where]], [[SQL Left Join]], [[SQL Null Functions]] - **μ°Έμ‘° λ§₯락:** NULL을 닀뀄야 ν•˜λŠ” λͺ¨λ“  쿼리의 기초 β€” 이후 SQL Null Functions(COALESCE λ“±)μ—μ„œ NULL λŒ€μ²΄ ν•¨μˆ˜λ‘œ ν™•μž₯. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” SQL NULL Values β€” https://www.w3schools.com/sql/sql_null_values.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "SQL NULL Values" page (Astra wiki-curation, P-Reinforce v3.1 format).