客户表:
订单表:
满足条件的记录才会出现在结果集中
隐式内连接:select first_name, last_name, order_date, order_amountfrom customers, orders where customers.customer_id = orders.customer_id显示内连接:select first_name, last_name, order_date, order_amountfrom customers cinner join orders oon c.customer_id = o.customer_id结果集:
左表全部出现在结果集中,若右表无对应记录,则相应字段为NULL
select first_name, last_name, order_date, order_amountfrom customers cleft join orders oon c.customer_id = o.customer_id结果集:
右表全部出现在结果集中,若左表无对应记录,则相应字段为NULL
select first_name, last_name, order_date, order_amountfrom customers cright join orders oon c.customer_id = o.customer_id结果集:
全外连接=左外连接+右外连接
select first_name, last_name, order_date, order_amountfrom customers cfull join orders oon c.customer_id = o.customer_id结果集: