高分求一道SQL数据库问题,急!!!(在线等)
发布网友
发布时间:2022-04-11 02:09
我来回答
共3个回答
热心网友
时间:2022-04-11 03:39
以下SQL语句在SQL Server 2005 Express中测试通过
第一题:CREATE TABLE SHOP
(
S# bigint NOT NULL,
SName nvarchar(50) NOT NULL,
Area nvarchar(50) NOT NULL,
MGR_NAME nvarchar(50) NOT NULL
) ;
第二题:
SELECT GNAME, MGR_NAME FROM SHOP, GOODS, SALE
WHERE GOODS.G#=SALE.G# and SALE.S#=SHOP.S# and SHOP.AREA="EAST"
第三题:
SELECT G#, GNAME FROM GOODS where GNAME like '冰箱'
第四题
CREATE VIEW 商品视图 AS
SELECT G#,GNAMES, S#, SNAME, QUANTITY, AREA
FROM SHOP, GOODS, SALE
WHERE QUANTITY>2000 and GOODS.G#=SALE.G# and SALE.S#=SHOP.S#
热心网友
时间:2022-04-11 04:57
1.
create table shop
(
S# int not null,
SNAME varchar(50) null,
AREA varchar(200) null,
MGR_NAME varchar(10) null,
primary key (S#)
)
2.
select SNAME,MGR_NAME from SHOP where AREA='EAST'
3.
select G#,PRICE from GOODS where GNAME='冰箱'
4
create view shop_goods_sale
as
select b.G#,b..GNAME,c.S#,a.SNAME,c.QUANTITY,a.AREA from SHOP a,GOODS b,SALE c
where a.S#=c.S# and b.G#=c.G# and c.QUANTITY>2000
热心网友
时间:2022-04-11 06:31
1.SHOP表的属性的数据类型都可以为varchar(20)就行了的。
2.select GNAME, MGR_NAME
from SHOP, GOODS, SALE
where GOODS.G#=SALE.G# and SALE.S#=SHOP.S#
and SHOP.AREA='EAST';
3.select G#,GNAME
from GOODS
where GNAME='冰箱';
4.create view GOODS_VIEW
as
select GOODS.G#,GOODS.GNAME,SHOP.S#,SHOP.SNAME,SALE.QUANTITY,SHOP.AREA
from SHOP,GOODS,SALE
where SHOP.S#=SALE.S# and GOODS.G#=SALE.G#
and SALE.QUANTITY>2000