[code=SQ]Lselect a_stu.s_name,a_cou.c_name from a_stu,a_cou,a_cou_stu where a_stu.学号=a_cou_stu.学号(+) a_cou_stu.课程号=a_cou.课程号(+) [/code]--别忘记表字段的名称! 没有办法,只能加中文
[code=SQ]L select a_stu.s_name,a_cou.c_name from a_stu,a_cou,a_cou_stu where a_stu.学号=a_cou_stu.学号(+) and a_cou_stu.课程号=a_cou.课程号(+) and a_stu.s_name='张三' [/code]
[code=SQ]Lselect a_stu.s_name,a_cou.c_name from a_stu,a_cou,a_cou_stu where a_stu.学号=a_cou_stu.学号(+) and a_cou_stu.课程号=a_cou.课程号(+) and a_stu.s_name='张三' [/code]
然后取a_stu的学生名称和a_cou的课程名称
where a_stu.s#=a_cou_stu.s# and a_cou_stu.c#=a_cou.c#
where 学生表的学生id=学生课程关系表的学生id
and 课程表的课程id=学生课程表的课程id
002 数学
003 英语a_cou_stu 学生课程关系表001 S201101
003 S201101
002 S201102
003 S201102
001 S201103
a_stu 学生表S201101 张三
S201102 李四
S201103 王五
查询出来的结果是:
s_name c_name
张三 语文
张三 英语
from a_stu,a_cou,a_cou_stu
where a_stu.学号=a_cou_stu.学号(+)
a_cou_stu.课程号=a_cou.课程号(+)
[/code]--别忘记表字段的名称! 没有办法,只能加中文
select a_stu.s_name,a_cou.c_name
from a_stu,a_cou,a_cou_stu
where a_stu.学号=a_cou_stu.学号(+)
and a_cou_stu.课程号=a_cou.课程号(+)
and a_stu.s_name='张三' [/code]
from a_stu,a_cou,a_cou_stu
where a_stu.学号=a_cou_stu.学号(+)
and a_cou_stu.课程号=a_cou.课程号(+)
and a_stu.s_name='张三'
[/code]