其实关系代数和关系演算是很麻烦,很抽象的早期代码。参考学习帮助理解数据库运算即可,学会学懂SQL(结构化查询语言,普遍使用)才是王道。你的问题答案代码比较多,我给你总结到文件里了,下载看吧。
三。1.select s.sname from spj,p,s where spj.sno=s.sno and spj.pno=p.pno
and p.color='red'
2.select spj.jno from spj where sno in
(
select sno from s where s.city<>'tianjin'
)
3. update spj set sno='S3' where
sno='S5' and pno='p6' and jno='j4'
四.
1. select s#,sname from s where age>22 and sex='男'
2. select c# from c where c# not in (select c# from s,sc where s.s#=sc.s# and sname='张平')
3. select sname from s where s# in( select s# from sc where avg(grage)>80)
4. select sname,sex from s,(select s# from sc where count(s#)>2) t
where t.s#=t.s#
五、
1.
create view v-ssc(
select s.sno,s.sname,sc.cno,sc.grade from s,sc
where s.sno=sc.sno
order by s.sno
)
2.
select sname,cno,grade from v_ssc a
where (select avg(GRADE) from v_ssc b a.sno=b.sno)>90
六、
1.select 图书名,max(定价) from 图书,图书发行
where 图书.图书编号=图书发行.图书编号
2.发行"数据库系统基础"的出版社名字
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)