sql语句快速入门基础篇

一:增删改查

 

 

insert into + 表名(列名字段)value(列名对应值)

如:insert into student(id,name,sex)value('1','小白','男');

delete from +表名 where +条件;

如:delete  from bm_act_spot_check_audit where id = '2612' ;

update +表名 set 列名字段 改为 值 where +条件;

如:update bm_act_spot_check_audit set `city_id`='110100' where `id`='2612' ;

select * from +表名 where + 条件

如:select * from bm_act_spot_check_audit where `rider_name`='测试'  ;

select  列名字段 from +表名 where + 条件 即 只查询 该列数据

如:select act_type from bm_act_spot_check_audit where `rider_name`='测试'  ;

二:常用函数

求平均值 avg(列名字段)

select avg(plan_id) from bm_act_spot_check_audit where `rider_name`='测试' and `act_type`='2' ;

求最小绝对值 min(列名字段)

select min(plan_id) from bm_act_spot_check_audit where `rider_name`='测试' and `act_type`='2' ;

求最大绝对值 max(列名字段)

select max(plan_id) from bm_act_spot_check_audit where `rider_name`='测试' and `act_type`='2' ;

求和 sum(列名字段)

select sum(plan_id) from bm_act_spot_check_audit where `rider_name`='测试' and `act_type`='2' ;

求计算条数 count(*)

select count(*) from `bm_act_spot_check_audit` where `rider_name`='测试' and `act_type`>1;

三:排

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值