在编写SQL查询时需要帮助吗
请有人能帮我写一个SQL查询。我不知道,但我只是需要一个快速修复 我试着这样做:在编写SQL查询时需要帮助吗,sql,Sql,请有人能帮我写一个SQL查询。我不知道,但我只是需要一个快速修复 我试着这样做: select college.colg_id, college.student_id, student.student_name from college, student where college.student_id=student.student_id; 这给了我所有我不确定的数据 colg_id student_id 1
select college.colg_id,
college.student_id,
student.student_name from college,
student
where college.student_id=student.student_id;
这给了我所有我不确定的数据
colg_id student_id
1 1
1 2
1 3
1 4
2 5
2 6
student_id student_name
1 a1
2 b1
3 c1
4 d1
5 e1
6 f1
我只需要数据的形式
colg_id | student_id | student_name.
我想帮忙,但请把你的问题格式化一点。。。我不明白你想达到什么目的现在清楚了吗。。。。我是从excel复制的。我不知道它是怎么排成一行的。若我用简单的话提问,我只想在college表的输出中添加student_name。其中,每个姓名均显示其各自的学生id
SELECT c.colg_id, c.student_id, s.student_name FROM college c
LEFT JOIN student s ON s.student_id = c.student_id