mysql连表查询

600阅读 0评论2016-06-20 TT小饭
分类:Mysql/postgreSQL

内连接:
    select student.*,grade.* from student join grade where student.sid=grade.sid;
    select s.*,g.* from student as s join grade as g where s.sid=g.sid;



外连接:
    左连接(左边的主,左边的数据多有)
    select * from student left join grade on student.sid=grade.sid;
    右连接
    select * from student right join grade on student.sid=grade.sid;

上一篇:python collections系列
下一篇:mysql缓存参数