--- id: sql-comments title: "SQL Comments" category: "Database" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["SQL comment syntax", "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", "comments"] raw_sources: ["https://www.w3schools.com/sql/sql_comments.asp"] applied_in: [] github_commit: "" --- # [[SQL Comments]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) SQL supports single-line (`--`) and multi-line (`/* */`) comments, ignored by the database engine, useful both for documentation and for temporarily disabling parts of a statement β€” except in Microsoft Access, which supports neither. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Purpose** β€” explain SQL code, or temporarily prevent execution of code (for debugging); comments are ignored by the database engine. [S1] - **Single-line comments** β€” start with `--` and continue to the end of the line. [S1] - **Multi-line comments** β€” start with `/*` and end with `*/`; any text between is ignored. [S1] - **MS Access exception** β€” comments are not supported in Microsoft Access databases. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Comment-out-to-disable** β€” appending `--` or wrapping in `/* */` is used not just for documentation but as a quick way to disable a clause, a whole statement, or several statements at once without deleting code. [S1] - **Inline partial comment** β€” a multi-line comment can mask just part of a line/statement (e.g. commenting out one column or one OR-branch) while the rest still executes. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Single-line as explanation: `-- Selects all German customers` followed by the query. [S1] - Single-line to comment out the end of a line: `SELECT * FROM Customers -- WHERE City='Berlin';`. [S1] - Single-line to disable an entire statement: `-- SELECT * FROM Customers;` followed by a different active statement. [S1] - Multi-line as explanation: `/* Selects all German customers from Berlin */` followed by the query. [S1] - Multi-line to disable several statements at once. [S1] - Multi-line to mask part of a column list: `SELECT CustomerName, /*City,*/ Country FROM Customers;`. [S1] - Multi-line to mask part of an OR chain inside a WHERE clause. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **MS AccessλŠ” 주석을 μ§€μ›ν•˜μ§€ μ•ŠμŒ** β€” λ‹€λ₯Έ λͺ¨λ“  SQL λ°©μ–Έκ³Ό λ‹€λ₯Έ μ˜ˆμ™Έ μ‚¬ν•­μœΌλ‘œ μ†ŒμŠ€μ— λͺ…μ‹œλ¨. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” 디버깅 쀑 쿼리 일뢀λ₯Ό μž„μ‹œλ‘œ λΉ„ν™œμ„±ν™”ν•˜λŠ” μš©λ„λ‘œ μ‹€λ¬΄μ—μ„œ ν”νžˆ 쓰인닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Single-line and multi-line comments (SQL): ```sql -- Selects all German customers SELECT * FROM Customers WHERE Country = 'Germany'; /* Selects all German customers from Berlin */ SELECT * FROM Customers WHERE Country = 'Germany' AND City = 'Berlin'; ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.88 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[SQL Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[SQL Syntax]] - **μ°Έμ‘° λ§₯락:** SQL μ½”λ“œ λ¬Έμ„œν™” 및 디버깅 μ‹œ 쿼리 일뢀λ₯Ό λΉ„ν™œμ„±ν™”ν•  λ•Œ μ‚¬μš© β€” MS Accessμ—μ„œλŠ” μ§€μ›λ˜μ§€ μ•ŠμŒμ— 유의. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” SQL Comments β€” https://www.w3schools.com/sql/sql_comments.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "SQL Comments" page (Astra wiki-curation, P-Reinforce v3.1 format).