今日成果:
SELECT
p.product_id, name, oi.quantity
FROM
products p
LEFT JOIN
order_items oi ON p.product_id = oi.product_id;
-- 查询所有产品信息
-- LEFT JOIN 左连接:返回所有左表的结果
select o.order_date,o.order_id,c.first_name as customer,sh.name as shipper,os.name as status from orders o
left join customers c on o.customer_id = c.customer_id
left join shippers sh on o.shipper_id = sh.shipper_id
left join order_statuses os on o.status = os.order_status_id;
-- 查询指定的订单结果
-- 多表外连接;内连接:只返回非空的结果 ;外连接:返回包含空的结果
感谢各位读者查阅,欢迎各位👍点赞?评论?收藏+关注!