愚见:create table 商品表 (商品编号 int,商品名 nvarchar(10),颜色 nvarchar(10))create table 供应商表 (供应商号 int,供应商姓名 nvarchar(10),地址 nvarchar(400))create table 供应表 (主键 int,商品编号 int,供应商号 int,供应量 int,供应时间 datetime)insert 商品表 select 1,'商品1','红' union all select 2,'商品2','黄' union all select 3,'商品3','白' insert 供应商表 select 1,'供应商A','kfjskdjflksdjflj' union all select 2,'供应商B','wererwer' union all select 3,'供应商C','gdbdbbdfv' union all select 4,'供应商D','uyu5jhtjtytj' insert 供应表 --若每名供应商可以供应多种商品,每种商品可由多名供应商供应 select 1,1,3,30,'2011-6-02' union all select 2,1,4,23,'2011-6-03' union all select 3,2,1,100,'2011-6-04' union all select 4,3,3,80,'2011-6-02' union all select 5,1,2,65,'2011-6-05' union all select 6,3,3,85,'2011-6-08' union all select 7,1,2,110,'2011-6-03'
#8的数据做得有些马虎..insert 供应表 --若每名供应商可以供应多种商品,每种商品可由多名供应商供应 select 1,1,3,30,'2011-6-02' union all select 2,2,1,100,'2011-6-04' union all select 3,3,3,80,'2011-6-02' union all select 4,1,2,65,'2011-6-05' union all select 5,3,4,85,'2011-6-08' union all select 6,1,1,110,'2011-6-03' --编号为 1 的商品同供应商 1、2、3、4 提供 --编号为 2 的商品同供应商 1 提供 --编号为 3 的商品同供应商 3、4 提供--供应商 1 提供商品 1、2 --供应商 2 提供商品 1 --供应商 3 提供商品 1、3 --供应商 4 提供商品 3
(商品编号 int,商品名 nvarchar(10),颜色 nvarchar(10))create table 供应商表
(供应商号 int,供应商姓名 nvarchar(10),地址 nvarchar(400))create table 供应表
(主键 int,商品编号 int,供应商号 int,供应量 int,供应时间 datetime)insert 商品表
select 1,'商品1','红' union all
select 2,'商品2','黄' union all
select 3,'商品3','白' insert 供应商表
select 1,'供应商A','kfjskdjflksdjflj' union all
select 2,'供应商B','wererwer' union all
select 3,'供应商C','gdbdbbdfv' union all
select 4,'供应商D','uyu5jhtjtytj' insert 供应表 --若每名供应商可以供应多种商品,每种商品可由多名供应商供应
select 1,1,3,30,'2011-6-02' union all
select 2,1,4,23,'2011-6-03' union all
select 3,2,1,100,'2011-6-04' union all
select 4,3,3,80,'2011-6-02' union all
select 5,1,2,65,'2011-6-05' union all
select 6,3,3,85,'2011-6-08' union all
select 7,1,2,110,'2011-6-03'
select 1,1,3,30,'2011-6-02' union all
select 2,2,1,100,'2011-6-04' union all
select 3,3,3,80,'2011-6-02' union all
select 4,1,2,65,'2011-6-05' union all
select 5,3,4,85,'2011-6-08' union all
select 6,1,1,110,'2011-6-03' --编号为 1 的商品同供应商 1、2、3、4 提供
--编号为 2 的商品同供应商 1 提供
--编号为 3 的商品同供应商 3、4 提供--供应商 1 提供商品 1、2
--供应商 2 提供商品 1
--供应商 3 提供商品 1、3
--供应商 4 提供商品 3