SELECT * FROM student a LEFT JOIN sc b ON a.Sid = b.Sid AND a.Sname="赵雷"
结果:(left join 左连接,左表所有数据 拼接 右表符合on条件的数据。on后用and连接,‘a.Sid = b.Sid AND a.Sname="赵雷"’都作为on条件)
SELECT * FROM student a LEFT JOIN sc b ON a.Sid = b.Sid WHERE a.Sname="赵雷"
结果:(当on后用where连接,where作为筛选条件,筛选‘student a LEFT JOIN sc b ON a.Sid = b.Sid’的结果集)