文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>sql学习2

sql学习2

时间:2010-09-25  来源:为你抒写

 use nanwang

go /*创建一个goods表,该表记录了货品的代号,名称,描述,库存量,供应商,状态,价格等信息*/ /*说明下,此表因为没有建立两个。。所以。。二次查询。。等一些都没有后期会不上去的*/ create table Goods (gid smallint primary key, Gname varchar(20) not null, Description varchar(100) not null, Storage int, Supplier varchar(50), Status tinyint Default(0), Price money ) go select *from goods go use nanwang insert into Goods(gid,Gname,Description,Storage,Supplier,Status)  values ('1','nanwang','nanwang','10','zhongfei','0') insert into Goods(gid,Gname,Description,Storage,Supplier,Status)  values ('2','nanfei','nanfei','10','zhongnan','0') insert into Goods(gid,Gname,Description,Storage,Supplier,Status)  values ('3','dadao','nanfei','5','chenglong','0') go   select gname,storage from goods  go select gname,description,storage,price from goods where storage>3 select gname,description,storage,price from goods where storage>6 go /*between ..and。。是包含,and是不包含*/ select gname,description,storage,price from goods where storage between 6 and 10 select gname,description,storage,price from goods where storage>6 and storage<10 go select gname from goods where description='nanfei' go select gname,description,storage,price from goods where gname like 'N%' select gname,description,storage,price from goods where gname like '%i' select gname,description,storage,price from goods where gname like 'n[a]n%' select gname,description,storage,price from goods where gname like '[^n]%' select * from goods go select *gname,description,storage,price from goods where gname like go select avg(storage) as '库存' from goods select min(storage) as '库存' from goods select sum(storage) as '库存' from goods select count(storage) as '库存' from goods    
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载