
在数据库中 用函数实现 求某个专业选修了某门课程的学生人数
1个回答
展开全部
不知道用函数实现指的是什么,下面这个查询用了个聚合函数
select count(人员) 人数,专业,课程 from table where 专业='xxx' and 课程='xxx' group by 专业,课程
select count(人员) 人数,专业,课程 from table where 专业='xxx' and 课程='xxx' group by 专业,课程
追问
是用户定义函数 create function 那个
追答
oracle的语句
create or replace function qiurenshu(kc in varchar2,zy in varchar2)
return number
into student_count number;
begin
select count(人员) into student_count,专业,课程 from table
where 专业=zy and 课程=kc
group by 专业,课程;
return(student_count);
end;
/
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询