选课系统有三个表
create table student(stu_no varchar(4) primary key,stu_name varchar(10) not null,gender varchar(5),stu_age number(2) check(stu_age>=16 and stu_age<40),stu_dto varchar(20));
create table course(course_no varchar(4) primary key,course_name varchar(20) not null,cou_teacher varchar(10));
create table elective(stu_no varchar(4), course_no varchar(4),point number(3) check(point is null or point between 0 and 100),primary key(stu_no,course_no));
然后插入的数据,查询某位授课老师所授课程中分数最高的那位学生的名字及成绩
select stu_name,point
from student,course,elective,(select course_no,max(point) from elective group by as temp(course_no,max))
where student.stu_no=elective.stu_no and course.course_no=elective.course_no
and point=max and course.course_no=temp.course_no;
运行结果是ORA-00933:sql命令未正常结束,报错的星号停在as上,大家帮我看下
create table student(stu_no varchar(4) primary key,stu_name varchar(10) not null,gender varchar(5),stu_age number(2) check(stu_age>=16 and stu_age<40),stu_dto varchar(20));
create table course(course_no varchar(4) primary key,course_name varchar(20) not null,cou_teacher varchar(10));
create table elective(stu_no varchar(4), course_no varchar(4),point number(3) check(point is null or point between 0 and 100),primary key(stu_no,course_no));
然后插入的数据,查询某位授课老师所授课程中分数最高的那位学生的名字及成绩
select stu_name,point
from student,course,elective,(select course_no,max(point) from elective group by as temp(course_no,max))
where student.stu_no=elective.stu_no and course.course_no=elective.course_no
and point=max and course.course_no=temp.course_no;
运行结果是ORA-00933:sql命令未正常结束,报错的星号停在as上,大家帮我看下
解决方案 »
- 请教left join的问题
- 请教一个PLSQL连接问题!
- 如何为用户授予truncate其他用户表的权限?
- .NET写的网页,ORACLE数据库,总是报错ORA-01043,求救~~~
- 我的ORACLE数据库文件损坏了,SQL PLUS 都连不上,请问应该如何处理,谢谢
- 求几句sql的写法!!
- plsql能正常连接,toad报ORA-12154: TNS: 无法解析指定的连接标识符 错误
- 在personal oracle 9i中,原来的easy configration工具变成什么了?
- oracle语法问题
- 按照表中某个字段值不同,排序不同
- 如何优化,请求帮助.
- oracle8.1.7与oracle9.2.0的Link连接不能正常使用
from student,course,elective,(select course_no,max(point) from elective group by course_no,max)
where student.stu_no=elective.stu_no and course.course_no=elective.course_no
and point=max and course.course_no=temp.course_no;
from student,course,elective,(select course_no,max(point) max_point from elective group by course_no))
where student.stu_no=elective.stu_no and course.course_no=elective.course_no
and point=max_point and course.course_no=temp.course_no;
(select course_no,max(point) from elective group by course_no)
select stu_name,point
from student,course,elective,temp
where student.stu_no=elective.stu_no and course.course_no=elective.course_no
and point=max and course.course_no=temp.course_no;
(select course_no,max(point) max_p from elective group by course_no)
select stu_name,point
from student,course,elective,temp
where student.stu_no=elective.stu_no and course.course_no=elective.course_no
and point=max_p and course.course_no=temp.course_no;
SELECT column_name
FROM table_name AS table_alias
难道是因为在oracle下运行的原因