SQL求助 结果显示不全
createtableStore_Information(store_namechar(20),SalesSmallmoney,store_Datedatetime)in...
create table Store_Information(
store_name char(20),
Sales Smallmoney,
store_Date datetime
)
insert into Store_Information values ('Los Angeles',1500,7-05-1999)
insert into Store_Information values ('San Diego',250,7-07-1999)
insert into Store_Information values ('Los Angeles',300,7-08-1999)
insert into Store_Information values ('Los Angeles',700,7-08-1999)
create table Geography(
region_name char(20),
store_name char(20)
)
drop table Geography
insert into Geography values ('East','Boston')
insert into Geography values ('East','New York')
insert into Geography values ('West','Los Angeles')
insert into Geography values ('West','San Diego')
create view vrs
as select a1.region_name region,sum(a2.Sales) sales
from Geography a1,Store_Information a2
where a1.store_name=a2.store_name
group by a1.region_name
select * from vrs
1.我的结果显示
region sales
West 2750.00
正确应该是
East 700
West 2050
是哪里的问题,等!! 展开
store_name char(20),
Sales Smallmoney,
store_Date datetime
)
insert into Store_Information values ('Los Angeles',1500,7-05-1999)
insert into Store_Information values ('San Diego',250,7-07-1999)
insert into Store_Information values ('Los Angeles',300,7-08-1999)
insert into Store_Information values ('Los Angeles',700,7-08-1999)
create table Geography(
region_name char(20),
store_name char(20)
)
drop table Geography
insert into Geography values ('East','Boston')
insert into Geography values ('East','New York')
insert into Geography values ('West','Los Angeles')
insert into Geography values ('West','San Diego')
create view vrs
as select a1.region_name region,sum(a2.Sales) sales
from Geography a1,Store_Information a2
where a1.store_name=a2.store_name
group by a1.region_name
select * from vrs
1.我的结果显示
region sales
West 2750.00
正确应该是
East 700
West 2050
是哪里的问题,等!! 展开
4个回答
展开全部
肯定没有east的数据,因为你输入的几个数据都是west的数据,请看
insert into Store_Information values ('Los Angeles',1500,7-05-1999)
insert into Store_Information values ('San Diego',250,7-07-1999)
insert into Store_Information values ('Los Angeles',300,7-08-1999)
insert into Store_Information values ('Los Angeles',700,7-08-1999)
再看
insert into Geography values ('East','Boston')
insert into Geography values ('East','New York')
insert into Geography values ('West','Los Angeles')
insert into Geography values ('West','San Diego')
发现没?'New York'和'Boston'的数据完全找不到,小同学,要仔细点呀
insert into Store_Information values ('Los Angeles',1500,7-05-1999)
insert into Store_Information values ('San Diego',250,7-07-1999)
insert into Store_Information values ('Los Angeles',300,7-08-1999)
insert into Store_Information values ('Los Angeles',700,7-08-1999)
再看
insert into Geography values ('East','Boston')
insert into Geography values ('East','New York')
insert into Geography values ('West','Los Angeles')
insert into Geography values ('West','San Diego')
发现没?'New York'和'Boston'的数据完全找不到,小同学,要仔细点呀
展开全部
结果显示正确着呢,你只有west的人有购买记录,east没有啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Store_Information表里的数据错了 三个 Los Angeles 你先改了看看
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |