oracle数据库面试题,如下,求解!
1个回答
展开全部
1
product主键id
顾客表主键acid
商品交易表为联合主键(acid+id),同时acid和id分别是顾客表和商品表的外键
2
select b.acname,b.acadress
from product a,customer b,order c where a.id=c.id and b.acid=c.acid
and a.name='李子'
3
select t1.acname
from
(select b.acname
from product a,customer b,order c where a.id=c.id and b.acid=c.acid
and a.name='李子') t1,
(select b.acname
from product a,customer b,order c where a.id=c.id and b.acid=c.acid
and a.name='苹果') t2
where t1.acname=t2.acname
4
select b.acname,
sum(case when type='家电' then a.price*c.amount else 0 end) as 家电价格,
sum(case when type='水果' then a.price*c.amount else 0 end) as 水果价格
from product a,customer b,order c where a.id=c.id and b.acid=c.acid
group by b.acname
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询