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

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;
主站蜘蛛池模板: 清新县| 乐业县| 潜山县| 上饶市| 东阳市| 乡城县| 吕梁市| 理塘县| 当阳市| 莆田市| 福鼎市| 深州市| 新竹市| 新营市| 措美县| 中西区| 丰城市| 易门县| 会东县| 广水市| 连南| 怀化市| 黄浦区| 墨脱县| 孟连| 从化市| 临颍县| 南汇区| 惠安县| 洞口县| 揭阳市| 郁南县| 聂拉木县| 高雄市| 喀喇| 石柱| 武邑县| 金寨县| 龙州县| 巨野县| 儋州市|