关联更新,关联查询

关联更新io

  • update A,B SET A.c1=B.c1,A.c2=B.c2 where A.id=B.id and ...
  • update A inner join B on A.id=B.id set A.c1=B.c1,A.c2=B.c2 where...

关联查询date

  • 交叉链接(cross join),内链接(inner join),外链接(left join,right join),全链接(full join), 联合查询(union, union all),嵌套查询
  • 交叉链接,笛卡尔积
  • 内链接可分为,等值链接,不等值链接,自链接
  • MYSQL不支持全链接,但能够经过外链接和union模拟
  • union和union all 都须要查询列数相同,union会合并重复(相同)记录行,union all不合并重复记录行

注意事项nio

   外链接时,因为重复致使结果为笛卡尔积查询

相关文章
相关标签/搜索