表连接
--表连接
select Students .Name ,Students .Age,Classes .Name from Students
join Classes on Students .CId =Classes .Id
--查询年龄大于3的学生
select Students .Name ,Students .Age ,Classes .Name from Students
join Classes on Students .CId =Classes .Id where Students .Age >3
--left join 会把左边的表的数据全部查出来
select Students .Name ,Students .Age ,Students .Birthday,classes.Name from Students
left join Classes on Students .CId =Classes .Id
--right join 首先满足右表的数据,如果连接条件满足就显示左表的数据,如果不满足就显示null
select Students .Name ,Students .Age ,Students .Birthday,classes.Name from Students
right join Classes on Students .CId =Classes .Id