--- id: sql-constraints title: "SQL Constraints" category: "Database" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["SQL Constraint Types", "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", "constraints"] raw_sources: ["https://www.w3schools.com/sql/sql_constraints.asp"] applied_in: [] github_commit: "" --- # [[SQL Constraints]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) Constraints are rules enforced on table data that abort any action violating them, specifiable either at table creation or added afterward via ALTER TABLE. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **SQL constraints** β€” rules for data in a table; prevent invalid data insertion and ensure accuracy/reliability; a violating action is aborted. [S1] - **When specified** β€” at CREATE TABLE time, or later via ALTER TABLE. [S1] - **Constraint types** β€” `NOT NULL`, `UNIQUE`, `PRIMARY KEY`, `FOREIGN KEY`, `CHECK`, `DEFAULT`, `CREATE INDEX`. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **PRIMARY KEY as composite constraint** β€” the source frames PRIMARY KEY as "a combination of NOT NULL and UNIQUE", clarifying it isn't a separate primitive but a composition of two simpler constraints. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) 이 λ¬Έμ„œλŠ” 개둠 νŽ˜μ΄μ§€λ‘œ, NOT NULL/UNIQUE/PRIMARY KEY/FOREIGN KEY/CHECK/DEFAULT/CREATE INDEX 각각은 μ΄μ–΄μ§€λŠ” κ°œλ³„ μ±•ν„°μ—μ„œ 문법과 μ˜ˆμ œκ°€ μƒμ„Ένžˆ 닀뀄진닀. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” 이 개둠 뒀에 7κ°€μ§€ μ œμ•½μ‘°κ±΄ 각각의 μ „μš© 챕터가 이어진닀. [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 Not Null]], [[SQL Unique]], [[SQL Primary Key]], [[SQL Foreign Key]], [[SQL Check]], [[SQL Default]], [[SQL Create Index]] - **μ°Έμ‘° λ§₯락:** 7κ°€μ§€ μ œμ•½μ‘°κ±΄ μ±•ν„°μ˜ μƒμœ„ 개둠 λ¬Έμ„œ. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” SQL Constraints β€” https://www.w3schools.com/sql/sql_constraints.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "SQL Constraints" page (Astra wiki-curation, P-Reinforce v3.1 format).