内连接
-- 通过查看图书信息表和图书类别表来获取图书编号、图书名称、图书类别
select book_id,book_name,category from bookinfo inner join bookcategory on bookinfo.book_category_id=bookcategory.category_id
外连接
左外连接
-- 根据业务需求,我们需要查看图书类别表中的所有类别下都有哪些图书
SELECT book_id,book_name,category from bookcategory left join bookinfo on bookcategory.category_id = bookinfo.book_category_id