
用MySQL测试通过,尽量写标准SQL,如果是其他数据库,应该可以通过或稍加修改即可通过。
13
select
t2sname
from
sp
t1
left
join
s
as
t2
on
t1sno=t2sno
left
join
p
t3
on
t1pno=t3pno
where
t3color='red'
group
by
t2sname
14
select
sno,sname,status
from
s
where
city='BJ'
15
select
sum(t1qty)
from
sp
t1
left
join
p
t2
on
t1pno=t2pno
where
t2pname='p2'
16
update
p
set
weight=100
where
pname='p2'
17
update
p
set
color='yellow'
where
pname='p2'
18
select
t2sn
from
spj
t1
left
join
s
t2
on
t1sno=t2sno
left
join
p
t3
on
t1pno=t3pno
left
join
j
t4
on
t1jno=t4jno
where
t3color='red'
and
t4jn='j1'
group
by
t2sno
19
select
t2jn
from
spj
t1
left
join
j
t2
on
t1jno=t2jno
left
join
s
t3
on
t1sno=t3sno
left
join
p
t4
on
t1pno=t4pno
where
t3sn='s1'
group
by
t2jno
20
select
t2pn
from
spj
t1
left
join
p
t2
on
t1pno=t2pno
left
join
s
t3
on
t1sno=t3sno
left
join
j
t4
on
t1jno=t4jno
where
t3city=t4city
group
by
t2pno
三。
1select ssname from spj,p,s where spjsno=ssno and spjpno=ppno
and pcolor='red'
2select spjjno from spj where sno in
(
select sno from s where scity<>'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 ss#=scs# 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 ts#=ts#
五、
1
create view v-ssc(
select ssno,ssname,sccno,scgrade from s,sc
where ssno=scsno
order by ssno
)
2
select sname,cno,grade from v_ssc a
where (select avg(GRADE) from v_ssc b asno=bsno)>90
六、
1select 图书名,max(定价) from 图书,图书发行
where 图书图书编号=图书发行图书编号
2发行"数据库系统基础"的出版社名字
以上就是关于数据库初学求解答全部的内容,包括:数据库初学求解答、几道数据库题,答对了200分!!!、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)