--内联接---- select goods_id,goods_name,cate_name from tdb_goods inner join tdb_goods_cates on tdb_goods.cate_id=tdb_goods_cates.cate_idG; 内联接返回两张表中都有的 select goods_id,goods_name,brand_name from tdb_goods inner join tdb_brand on tdb_goods.brand_id=tdb_brand.brand_id; --左连接-- select goods_id,goods_name,cate_name from tdb_goods left join tdb_goods_cates on tdb_goods.cate_id=tdb_goods_cates.cate_idG; 左联接返回第一张(即左边)表中都有的 select goods_id,goods_name,brand_name from tdb_goods left join tdb_brand on tdb_goods.brand_id=tdb_brand.brand_id; 所参照右表没有的值用null代替 --右连接-- select goods_id,goods_name,cate_name from tdb_goods right join tdb_goods_cates on tdb_goods.cate_id=tdb_goods_cates.cate_idG; 右联接返回第二张(即右边)表中都有的 select goods_id,goods_name,brand_name from tdb_goods right join tdb_brand on tdb_goods.brand_id=tdb_brand.brand_id; 所参照左表没有的值用null代替 对照:select goods_id,goods_name,brand_name from tdb_brand left join tdb_goods on tdb_goods.brand_id=tdb_brand.brand_id; 总结:内联接只会显示两张表中都有的列,左连接参照左表,右表中无值就设null,右连接参照右表,左表无值就设null,左右连接可互换表名结果相同。