关于sql语句
Posted 依崇稀
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于sql语句相关的知识,希望对你有一定的参考价值。
//增加
insert into a(name,score) values()
//删除
delete from biao where 字段
truncate biao
//更新数据
update biao set 字段=新
//查询数据
select ziduan from biao where tiaojian
//查询所有
select from biao
//使用别名
select ziduan as ‘‘,ziduan2 from biao
//where条件
select*from biao where ziduan1 and ziduan2
//between and
select * from biao where ziduan between and
//空条件查询
select * from biao where ziduan IS Null
//模糊查询
select * from biao where ziduan like ‘%w%‘
//去除重复数据
select distinct ziduan from biao
//排序
select * from biao order by lieming asc/desc
//聚合查询
select count(lieming)tiaojian from biao;
select min(lieming)tiaojian from biao;
select max() tiaojianfrom biao;
select avg() tiaojianfrom biao;
select sum() tiaojianfrom biao;
//分组查询
select count(lieming) boys from ziduan group by tiaojian;
//筛选条件后使用
select count(lieming) boys from ziduan group by tiaojian having;
以上是关于关于sql语句的主要内容,如果未能解决你的问题,请参考以下文章