存储过程
基于ST数据库,创建下面的存储过程
利用学生姓名查询该生选修的课程名和成绩
create procedure name_search
@sname varchar(20)
as
begin
select Cname,Grade
from course,SC
where course.cno=sc.cno and sno={
select sno
from student
where Sname=@sname
}
end
exec name_search '李勇'
请指教这样写为什么不对啊,请高手指点,谢谢!
------解决方案--------------------{}----->()
------解决方案--------------------提示什么错误呢
------解决方案--------------------create procedure name_search
@sname varchar(20)
as
begin
select Cname,Grade
from course,SC
where course.cno=sc.cno and sno in (
select sno
from student
where Sname=@sname
)
------解决方案--------------------
create procedure name_search
@sname varchar(20)
as
begin
select Cname,Grade
from course,SC
where course.cno=sc.cno and sno={ =修改为in
select sno
from student
where Sname=@sname
}
end
exec name_search '李勇'
------解决方案--------------------where course.cno=sc.cno and sno
={
将=修改为in
select sno
from student
where Sname=@sname
}