1.连表查询
现有表1:student 列1:d 列2:name 和 表2:score 列1:id 列2:fraction
select student.name,score.fraction from student,score where student.id=1 and score.id=1; #查询1号id的成绩
或者
select student.name,score.fraction from student,score where student.id=score.id and name=’xiaohuang’; #查询xiaohuang的成绩
2.自连接查询 自连接的表必须要有共同的列和数据
select student.name,score.fraction from student natural join score where id=3;
3.内连接查询
select * from 表1 join 表2 on 关联条件 where 条件;
select student.name,score.fraction from student join score on student.id=score.id where name=’xiaohong’;