官术网_书友最值得收藏!

LEFT JOIN

LEFT JOIN retrieves all the records from the left table while only matching records from the right table. If we use the customer and order table example with left join, it will fetch all records from the order table even if there are no matches in the right table (customer). To fetch all order details for the customer, the following query can be used:

SELECT order.order_id, customer.name
FROM order
LEFT JOIN customer ON order.customer_id = customer.customer_id;
主站蜘蛛池模板: 灵璧县| 龙井市| 无为县| 旅游| 正宁县| 神池县| 沐川县| 景宁| 内丘县| 宁蒗| 方山县| 鹰潭市| 龙海市| 寻乌县| 沿河| 平顺县| 临泽县| 鄂托克旗| 福建省| 贡觉县| 常熟市| 顺平县| 左权县| 甘孜| 九寨沟县| 高州市| 灵璧县| 搜索| 田林县| 闸北区| 西贡区| 衡山县| 兴安盟| 乡城县| 安阳市| 乌鲁木齐市| 海安县| 安西县| 信阳市| 阿巴嘎旗| 施甸县|