MySql查询—— join

1、join

select a.student_name, a.student_score, b.student_class  FROM  student_tbl.A     JOIN  student_tbl.B    where  a.student_name =   b.student_name

#就是俩表join查询,条件是表A表B的某个相同字段相等VALUE的记录输出,可以用where作为条件查询,也可以使用  FROM A join B   ON  条件。

2、left join

select a.student_name, a.student_score,b.student_class  FROM student.A     LEFT    JOIN   student.B  where  a.student_name =   b.student_name

# 左链接查询的意思就是查询左表符合条件的全部记录,即便右表中无某一记录的数据,value用null返回。

3、right join 同理左查询

发布了34 篇原创文章 · 获赞 12 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/qq_32327737/article/details/99975284
今日推荐