![](https://i-blog.csdnimg.cn/blog_migrate/d2694e352d81f1af09ffcde3f441af3b.png)
![](https://i-blog.csdnimg.cn/blog_migrate/3f12c5b4002fbde69daef5de246979ac.png)
如上2图所示,student_inf表的外键 CLASSID 为表2 class_inf 中的字段 CLASSID , 做查询时可以用内联查询:
select
A.STUDENTID,
A.STUDENTNAME,
A.GENDER,
A.IDENTIFIED_STU,
A.ADDRESS,
A.STUDENTIMG,
A.AGE,
A.CLASSID,
B.CLASSNAME
from student_inf A
INNER JOIN CLASS_INF B ON B.CLASSID = A.Classid ;
![](https://i-blog.csdnimg.cn/blog_migrate/02e72fc759f05f44c41d18a3415f84fa.png)