1. 程式人生 > >Mysql資料庫,內連線多表查詢

Mysql資料庫,內連線多表查詢

student表
student
Result表
subject
subject表
在這裡插入圖片描述

組合查詢三個表中不同的列(外來鍵):StudentNo,StudentName,SubjectName,StudentResult

SELECT student.StudentNo,studentname,SubjectName,StudentResult
FROM student
INNER JOIN result ON result.Studentno=student.StudentNo
INNER JOIN subject ON subject.GradeID=student.GradeId

查詢結果
在這裡插入圖片描述