--- id: sql-delete title: "SQL Delete" category: "Database" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["SQL DELETE Statement", "DELETE statement", "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", "delete", "droptable"] raw_sources: ["https://www.w3schools.com/sql/sql_delete.asp"] applied_in: [] github_commit: "" --- # [[SQL Delete]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) DELETE removes rows from a table while keeping its structure intact β€” but omitting WHERE deletes every row, and only DROP TABLE removes the table itself. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **DELETE statement** β€” deletes existing records in a table. [S1] - **Syntax** β€” `DELETE FROM table_name WHERE condition;`. [S1] - **Delete all records, keep the table** β€” `DELETE FROM table_name;` (no WHERE) removes every row but preserves structure, attributes, and indexes. [S1] - **Delete the whole table** β€” `DROP TABLE table_name;` removes the table entirely, unlike DELETE. [S1] ## βš–οΈ 비ꡐ 및 선택 κΈ°μ€€ (Comparison & decision criteria) | ν•­λͺ© (Option) | μž₯점 | 단점 | μ–Έμ œ 선택 | |---|---|---|---| | **DELETE FROM table (WHERE μ—†μŒ)** | ν…Œμ΄λΈ” κ΅¬μ‘°Β·μ†μ„±Β·μΈλ±μŠ€λŠ” μœ μ§€λ¨ | λͺ¨λ“  행이 μ‚­μ œλ¨ | λ°μ΄ν„°λ§Œ λΉ„μš°κ³  μŠ€ν‚€λ§ˆλŠ” μž¬μ‚¬μš©ν•  λ•Œ | | **DROP TABLE** | ν…Œμ΄λΈ” μžμ²΄μ™€ λͺ¨λ“  데이터·ꡬ쑰λ₯Ό μ™„μ „νžˆ 제거 | 되돌릴 수 μ—†κ³  μŠ€ν‚€λ§ˆλ„ 사라짐 | ν…Œμ΄λΈ” 자체λ₯Ό 더 이상 μ“°μ§€ μ•Šμ„ λ•Œ | ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Delete a specific record: `DELETE FROM Customers WHERE CustomerName='Alfreds Futterkiste';`. [S1] - Delete all records, keep table structure: `DELETE FROM Customers;`. [S1] - Delete the entire table: `DROP TABLE Customers;`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. UPDATE와 λ§ˆμ°¬κ°€μ§€λ‘œ WHERE λˆ„λ½ μœ„ν—˜μ΄ λͺ…μ‹œμ μœΌλ‘œ 경고됨. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” DELETE(ν–‰ μ‚­μ œ)와 DROP TABLE(ν…Œμ΄λΈ” 자체 μ‚­μ œ)의 ꡬ뢄은 μ‹€λ¬΄μ—μ„œ ν”νžˆ ν˜Όλ™λ˜λŠ” 지점이닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Delete matching rows (SQL): ```sql DELETE FROM Customers WHERE CustomerName='Alfreds Futterkiste'; ``` Delete all rows, keep table (SQL): ```sql DELETE FROM Customers; ``` Drop the table entirely (SQL): ```sql DROP TABLE Customers; ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[SQL Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[SQL Update]], [[SQL Where]], [[SQL Drop Table]] - **μ°Έμ‘° λ§₯락:** CRUD의 Delete μΆ• β€” DROP TABLEκ³Ό ν˜Όλ™ν•˜μ§€ μ•ŠλŠ” 것이 핡심. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” SQL DELETE Statement β€” https://www.w3schools.com/sql/sql_delete.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "SQL DELETE Statement" page (Astra wiki-curation, P-Reinforce v3.1 format).