什么是多表关联查询,有几种多表关联的查询方式,分别是什么?

2018-09-27  本文已影响0人  寧寧欧尼

多表查询

外键:只因用另一个表中的一列或者多列,被引用的列应该具有主键约束或唯一性约束。外键用于建立和加强两个表数据之间的连接。

多表查询关联查询有哪些?

select * from table1 left join select * from table2 on table1.id=table2.id 左连接
select * from table1 right join select * from table2 on table1.id=table2.id 右连接
select * from table1 cross join select * from table2 交叉连接
select * from table1 union join select * from table2 on table1.id=table2.id
select * from table1 where table1.id in (select id from table 2)

上一篇 下一篇

猜你喜欢

热点阅读