Mysql for navicat 之多表连接查询

新建两张表:

course:                                     student:

                       

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

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

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

完全外连接: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


猜你喜欢

转载自blog.csdn.net/weixin_40932524/article/details/80269542