SQL

2018-06-05  本文已影响0人  大大的小小小心愿

一、数据库计算总和
select SUM([需要求和的字段名称]) from [要求和的表名]
也可以在后面附加限制条件如: where [日期] > 'XXXX-XX-XX' and [日期] <= 'XXXX-XX-XX'

二、从大到小排序:
select * from 表名 order by 列 desc

三、只显示前5条数据:
SELECT * FROM business ORDER BY DATE DESC LIMIT 5

四、或者条件查询(or):
SELECT * FROM peopleInfo where date like '%5-11%' or date like '%5-12%' or date like '%5-13%' ; // 模糊查询
SELECT * FROM business_a WHERE price != '0'AND people_id != '112124'; // 具体查询

五、跟改某个字段的所有值
update table set col = '0';

六、sq查询数据除去某个字段的所有值:
select * from table where name not like '%张三%' and name not like '%李四%';
==============================================================
sql 执行语句:(查询是什么意思)
SELECT * FROM peopleInfo as a join store_address_information_b as b
on a.shop= b.online_shop_name WHERE a.date like '%5-15%'

上一篇 下一篇

猜你喜欢

热点阅读