--- id: sql-inner-join title: "SQL Inner Join" category: "Database" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["INNER JOIN", "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", "join", "inner-join"] raw_sources: ["https://www.w3schools.com/sql/sql_join_inner.asp"] applied_in: [] github_commit: "" --- # [[SQL Inner Join]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) INNER JOIN β€” the default join type, so plain JOIN means the same thing β€” returns only rows that have a match in both tables, discarding anything unmatched. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **INNER JOIN** β€” returns only rows that have matching values in both tables. [S1] - **JOIN == INNER JOIN** β€” `JOIN` alone defaults to `INNER JOIN`; the parser treats them identically. [S1] - **Syntax** β€” `SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name = table2.column_name;`. [S1] - **Multi-table INNER JOIN** β€” more than two tables can be joined by chaining multiple `INNER JOIN` clauses. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Table-name qualification is a good habit** β€” prefixing column names with their table (`Products.ProductID`) avoids ambiguity errors when the same column name (e.g. `CategoryID`) exists in both joined tables. [S1] - **Unmatched rows silently vanish** β€” a product with no `CategoryID`, or with a `CategoryID` absent from the Categories table, is simply excluded from the result β€” a common footgun when INNER JOIN is used where LEFT JOIN was intended. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Basic two-table join: `SELECT ProductID, ProductName, CategoryName FROM Products INNER JOIN Categories ON Products.CategoryID = Categories.CategoryID;`. [S1] - Qualified column names to avoid ambiguity: `SELECT Products.ProductID, Products.ProductName, Categories.CategoryName FROM Products INNER JOIN Categories ON Products.CategoryID = Categories.CategoryID;`. [S1] - `JOIN` is shorthand for `INNER JOIN` β€” both produce identical results. [S1] - Joining three tables: `FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID INNER JOIN Shippers ON Orders.ShipperID = Shippers.ShipperID;`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” SQL Aliases μ±•ν„°μ˜ ν…Œμ΄λΈ” 별칭(c, o)이 INNER JOIN μ˜ˆμ œμ—μ„œλ„ κ·ΈλŒ€λ‘œ μž¬μ‚¬μš©λœλ‹€. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Two-table INNER JOIN (SQL): ```sql SELECT Products.ProductID, Products.ProductName, Categories.CategoryName FROM Products INNER JOIN Categories ON Products.CategoryID = Categories.CategoryID; ``` Three-table INNER JOIN chain (SQL): ```sql SELECT Orders.OrderID, Customers.CustomerName, Shippers.ShipperName FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID INNER JOIN Shippers ON Orders.ShipperID = Shippers.ShipperID; ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[SQL Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[SQL Joins]], [[SQL Left Join]], [[SQL Aliases]] - **μ°Έμ‘° λ§₯락:** λ§€μΉ­λ˜λŠ” ν–‰λ§Œ ν•„μš”ν•œ 쑰인 쿼리의 κΈ°λ³Έ μœ ν˜• β€” LEFT/RIGHT/FULL JOINκ³Ό λŒ€λΉ„ν•΄μ„œ 이해해야 ν•œλ‹€. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” SQL INNER JOIN β€” https://www.w3schools.com/sql/sql_join_inner.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "SQL INNER JOIN" page (Astra wiki-curation, P-Reinforce v3.1 format).