oracle创建视图
视图中有collegeid(学院编号)、stuid(考生编号)、考生总成绩;请问这个视图怎么写?下面是我自己写的,报 不是 group by 表达式的错,请问怎么改正?
create or replace view view_will as
select college.collegeid,mat.stuid,sum(score.chinese+score.math+score.english+score.complex)
from college,mat,score
where college.collegeid=mat.first_will and mat.stuid=score.stuid
group by score.stuid having sum(score.chinese+score.math+score.english+score.complex)>500;
不能在select后写college.collegeid,mat.stuid
因为这两个项目不是group by的项目
改为以下试试
create or replace view view_will as
select college.collegeid,score.stuid,sum(score.chinese+score.math+score.english+score.complex)
from college,mat,score
where college.collegeid=mat.first_will and mat.stuid=score.stuid
group by college.collegeid,score.stuid having sum(score.chinese+score.math+score.english+score.complex)>500;
select后面出现的内容如果没有加聚集函数的话
那么必须同时也出现在唉GROUP BY后面
SQL code:
--不太了解你的具体需求和表结构 你试试下面的看行不行
create or replace view view_will as
select min(college.collegeid),min(mat.stuid),sum(score.chinese+score.math+score.english+score.complex)
from college,mat,s
相关问答:
我对SQL SERVER和ACCESS比较熟,所以数据库的通用基础东西可以说都掌握的差不多了,我现在想要的就是以上两数据库的独特之处的介绍和应用介绍。
另外书最好对应最新版本 oracle是11g吧 10的也行;mysql是5.1吧
谢 ......
大家好,我现在把oracle服务器上面的原始文件,下载到本机了.我想在本机访问数据库怎么设置啊.是不是类似可以建立一个什么虚拟服务器来实现.请大家出出主意
引用
大家好,我现在把oracle服务器上面 ......
我在创建数据库的时候用的名字为oracle10,但是创建好后,在默认的目录下显示的名称却是oracle10g,这是为什么?
你看的 10g是安装目录吧
SQL> select name from v$database;
NAME
---------
ORCL
......
private static final String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
private static final String USERNAME = "sys";
private static final String PASSWORD = "s ......