INNER JOIN
一句话解释
INNER JOIN 返回仅 行哪里连接条件 matches in 两者都表 — 非-matching 行是 排除.
用大白话说
INNER JOIN is the most common join type. It returns only rows that have a match in both tables. If a row in the left table has no matching row in the right table (or vice versa), it is excluded from the result.
For example, if you join 顺序 to 用户 with INNER JOIN, you get only orders that have a matching user. If an order has a user_id that does not exist in 用户 (should not happen with proper foreign keys), that order would be excluded.
INNER JOIN is symmetric — INNER JOIN B gives the same result as B INNER JOIN . It is the default join type, so you can write just JOIN.
示例
sql
-- Only orders with a matching user
SELECT orders.id, users.name
FROM orders
INNER JOIN users ON orders.user_id = users.id;返回行 仅哪里 matching 用户 exists for 顺序.
相关术语
相关资源
相关课程
- 连接
学习不同连接类型.
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。