mysql数据库(11)--进阶一之join

一、查看存储引擎

show variables like '%storage_engine%';

二、MyISAM与InnoDB的比较

 三、SQL书写顺序  vs 执行顺序

 

 四、Join连接(7种)

  • 内连接:select <select list>  from tableA inner join tableB on A.key = B.key
  • 左连接:select <select list>  from tableA left join tableB on A.key = B.key  (不满足的补NULL)
  • 右连接:select <select list>  from tableA right join tableB on A.key = B.key  (不满足的补NULL)
  • 左连接-内连接:select <select list>  from tableA left join tableB on A.key = B.key where B.key is NULL
  • 右连接-内连接:select <select list>  from tableA right join tableB on A.key = B.key where A.key is NULL
  • 全外连接= A独有+B独有+A、B共有:
    •   select <select list>  from tableA left join tableB on A.key = B.key union select <select list>  from tableA right join tableB on A.key = B.key  (union具有去重的功能)
  • 全外连接-内连接:
    •   select <select list>  from tableA left join tableB on A.key = B.key where B.key is NULL union select <select list>  from tableA right join tableB on A.key = B.key where A.key is NULL (union具有去重的功能)
原文地址:https://www.cnblogs.com/yif930916/p/15040375.html