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

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;
主站蜘蛛池模板: 香港 | 安西县| 苏州市| 宣城市| 怀集县| 怀化市| 六枝特区| 弥渡县| 台前县| 鸡泽县| 弥渡县| 四川省| 宜丰县| 麻城市| 姜堰市| 宣汉县| 吴江市| 枣阳市| 洛隆县| 鸡东县| 西充县| 隆林| 临夏市| 浦江县| 泸溪县| 长乐市| 长顺县| 土默特右旗| 华蓥市| 盐源县| 岳西县| 晋中市| 林芝县| 珠海市| 岗巴县| 大安市| 新巴尔虎左旗| 遂宁市| 建平县| 蕉岭县| 剑阁县|