经典的学生选课查询问题

wyman25 2009-08-06 04:41:44
student(stu_id,stu_name),course(cou_id,cou_name),stu_cou(stu_id,cou_id)(stu_cou为学生选课表)
一条sql语句选择出学生姓名和他的选择科目名称,怎么做??
...全文
114 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
fwacky 2009-08-06
  • 打赏
  • 举报
回复

select a.stu_name,b.course from student a ,course b,stu_cou c
where a.stu_id=c.stu_id and b.cou_id=c.cou_id
--小F-- 2009-08-06
  • 打赏
  • 举报
回复
select a.stu_name,b.course from student a ,course b,stu_cou c
where a.stu_id=c.stu_id and b.cou_id=c.cou_id
xuejie09242 2009-08-06
  • 打赏
  • 举报
回复
select stu_name,cou_name
from student s ,course c ,stu_cou sc
where s.stu_id=sc.stu_id and c.cou_id=sc.cou_id
昵称被占用了 2009-08-06
  • 打赏
  • 举报
回复
SELECT student.stu_name
,course.cou_name
FROM stu_cou
INNER JOIN student ON student.stu_id=stu_cou.stu_id
INNER JOIN course ON course.cou_id=stu_cou.cou_id
华夏小卒 2009-08-06
  • 打赏
  • 举报
回复

SELECT stu_name,cou_name from student a
join stu_cou b on a.stu_id=b.stu_id
join course c on c.cou_id=b.cou_id
feixianxxx 2009-08-06
  • 打赏
  • 举报
回复
...哈哈 3各月前 我还在上这个课 老师上面讲这个题来着。。
一眨眼 我成这样了。。
sdhdy 2009-08-06
  • 打赏
  • 举报
回复
select  a.stu_name, c.cou_name from student a
left join stu_cou b on a.stu_id=b.stu_id
left join course c on b.cou_id=c.cou_id
SQL77 2009-08-06
  • 打赏
  • 举报
回复
SELECT stu_name,cou_name FROM student S JOIN stu_cou  C ON  S.stu_id=C.stu_id JOIN course CC ON CC.cou_id=C.cou_id
feixianxxx 2009-08-06
  • 打赏
  • 举报
回复
select stu_name,cou_name
from student s ,course c ,stu_cou sc
where s.stu_id=sc.stu_id and c.cou_id=sc.cou_id
feixianxxx 2009-08-06
  • 打赏
  • 举报
回复
select stu_name,cou_name
from student s ,course,stu_cou sc
where s.stu_id=sc.stu_id and c.cou_id=sc.cou_id

34,576

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧