Mysql for navicat 之多表连接查询

新建两张表:

course:                                     student:

Mysql for navicat 之多表连接查询_第1张图片                       

1、外连接:左连接、右连接和完全外连接

左连接:select * from student left join course on student.ID=course.ID

Mysql for navicat 之多表连接查询_第2张图片

右连接:select * from student right join course on student.ID=course.ID

Mysql for navicat 之多表连接查询_第3张图片

完全外连接:select * from student full join course on student.ID=course.ID

2、内连接:select * from student inner join course on student.ID=course.ID(select * from student,course where student.ID=course.ID)


3、交叉连接:select * from student cross join course

Mysql for navicat 之多表连接查询_第4张图片

你可能感兴趣的:(Mysql for navicat 之多表连接查询)