MySQL
Posted saviour-chu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL相关的知识,希望对你有一定的参考价值。
序号 | 标题 | 内容 |
1 | 在mysql查询结果中添加自增ID | SELECT (@i :[email protected] + 1) AS i, tabName.* FROM tabName,(SELECT @i := 0) AS t |
2 | MySQL获取随机结果集 | SELECT * FROM tabName ORDER BY RAND() LIMIT 5 |
3 | 隐藏手机号码中间四位的方法 |
SELECT REPLACE(phone, SUBSTR(phone,4,4), ‘XXXX‘) FROM tabName SELECT INSERT(phone, 4, 4, ‘XXXX‘) FROM tabName |
4 | MySQL的between |
SELECT * FROM tabName WHERE id BETWEEN 5 AND 7 SELECT * FROM tabName WHERE id >= 5 AND id <= 7 |
5 | MySQL更新替换 | UPDATE tabName SET field=REPLACE(field,‘-01‘,‘-01-31‘) |
6 | MySQL保留小数 |
SELECT FORMAT(12562.6655,2);-- 千分位格式,返回值为string |
7 | ||
8 | ||
9 | ||
10 | ||
以上是关于MySQL的主要内容,如果未能解决你的问题,请参考以下文章