inner join和full join区别?
时间: 2023-12-13 07:34:33 浏览: 188
SQL联合查询inner join、outer join和cross join的区别详解
inner join和full join的区别如下:
1. inner join只返回两个表中都有匹配的行,而full join返回两个表中所有的行,如果某个表中没有匹配的行,则用NULL填充。
2. inner join的效率比full join高,因为full join需要对两个表进行全表扫描,而inner join只需要扫描匹配的行。
以下是inner join和full join的示例代码:
```sql
-- inner join示例
SELECT *
FROM table1
INNER JOIN table2
ON table1.column = table2.column;
-- full join示例
SELECT *
FROM table1
FULL JOIN table2
ON table1.column = table2.column;
```
阅读全文