由于楼上的5——8写的很好了,所以我就懒省事照搬过来了
1——4题答案在图片上;
5. create view AAA as
select maker, model, speed from product t1,PC t2 where t1.model=t2.model
union all select maker, model, speed from product t1,Laptop t2 where t1.model=t2.model
6. with tmp as ( select model,speed from PC union all select model,speed from Laptop)
select t2.maker from tmp t1, product t2
where t1.speed=(select max(speed) from tmp)
and t1.model=t2.model
7. update Product set maker='A' where maker='B'
8. select avg(price) from (
select model,price from PC where speed>=150
union all select model,price from laptop where speed>=150 )
1-4 实在不知道如何用关系代数式表达,头一次看到有这么问的 ^_^
不知道下面的是不是你想要的
1. laptop.hd>=20
2. maker='B'
3. max(max(speed) from pc union max(speed) from laptop)
4. group by maker, having count(model)=2
5. 到底是PC机还是手提电脑?还是两者都有? 下面的SQL是两者都有的情况
create view AAA as
select t1.maker, t1.model, t2.speed from product t1,PC t2 where t1.model=t2.model
union all
select t1.maker, t1.model, t2.speed from product t1,Laptop t2 where t1.model=t2.model
6.
with tmp as(
select model,speed from PC
union all
select model,speed from Laptop
)
select t2.maker from tmp t1, product t2
where t1.speed=(select max(speed) from tmp)
and t1.model=t2.model
7.
update Product set maker='A' where maker='B'
8.
select avg(price) from (
select model,price from PC where speed>=150
union all
select model,price from laptop where speed>=150
) t
你的题目写的也太粗糙了吧~~~哥英语不好,能不能把相应意思翻译下??