假设你有两个表,一个是学生表(students),包含学号(student_id)和姓名(name),另一个是选课表(course_selections),包含学号(student_id)、课程编号(course_code)和成绩(score)。你可以使用连接查询来获取选修了编号为’c01’课程的学生的学号、姓名和成绩。
以下是示例查询语句:
SELECT students.student_id, students.name, course_selections.score
FROM students
INNER JOIN course_selections ON students.student_id = course_selections.student_id
WHERE course_selections.course_code = 'c01';
这个查询将会返回选修了编号为’c01’课程的学生的学号、姓名和成绩。请注意根据实际情况替换表名和字段名,并确保数据库中存在相应的数据。
内容由零声教学AI助手提供,问题来源于学员提问




