1、inner join
解析:在表中存在至少一个匹配时,INNER JOIN 关键字返回行。
inner join 相当于 where u.id = a.id
只有符合条件的才会显示出来
例如:
只有符合t_borrowing表里面有book.id才会显示出来
所以只有不可借的书籍
2、left join
解析:LEFT JOIN 关键字会从左表 (table_name1) 那里返回所有的行,即使在右表 (table_name2) 中没有匹配的行。
无论t_borrowing里有无book.id都会显示出来
所以t_borrowing里没有book.id显示出可借
3、right join
解析:RIGHT JOIN 关键字会右表 (table_name2) 那里返回所有的行,即使在左表 (table_name1) 中没有匹配的行。