三个表之间的连接查询

------代码------

SELECT *
FROM student
INNER JOIN score ON student.sid = score.student_id
INNER JOIN class ON student.class_id = class.cid;

-------student为主表,score和class为从表  要想实现三表连接,就只需要再创建一个主表与从表外键约束------

------以下为运行结果------

猜你喜欢

转载自www.cnblogs.com/iexhongxin/p/11371868.html