2015.4物流系统。

物流系统数据库设计与查询
//物流系统。
//仓库:仓库号,仓库名,地点
//货物:货物号,货物名称,单价。
//物流表:仓库号,货物号,出入库数量,时间。
//需求:
 //   1,用sql建立三个表。主,外键。
 //   2,使用sql语句查询,单价高于100元的货物名,出入库总次数,总数量。
 
 creat table cangku
(
canno smallint primary key,
canname varchar(20) not null,
 place varchar(20) not null
  
 
 
 ); 

 creat table goods
 (
     goodsno smallint primary key,
     goodsname varchar(20) not null,
     goodsval smallint not null
 );
 
 creat table gft
 (
  canno smallint,
   goodsno smallint,
   lots int,
   lottime datatime,
   primary key(canno,goodsno),
  foreign key(goodsno) reference goods(goosno),
  foreign key(canno) reference cangku(canno)
  );
  
  单价高于100的货物名:
  select goodsname 
  from goods
  where goodsval>100;
  
  出入库总次数
  select count(datatime)
  from gft
  group by datatime;
  
  
  总数量
  seletct sum(lots)
  from gft;
  
  
  
  
  
  
  
  
  
  
  
  
  
  

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值