student表
sc 表
首先where条件a.Sid = b.Sid 查询
SELECT * FROM student a,sc b WHERE a.Sid = b.Sid GROUP BY a.Sname ORDER BY a.Sid
结果:(from后用‘,’分隔,两表inner join 搜索出a,b表都有的数据)
left join 条件查询
select * from student a LEFT JOIN sc b ON a.Sid = b.Sid GROUP BY a.Sname order BY a.Sid
结果:(left join 连接,左表数据全部+右表符合on条件的数据。left join 左右表互换结果不一样)
时间: 2024-10-25 10:52:13