当前位置:网站首页>[MySQL series] collection of common working SQL (continuous update)
[MySQL series] collection of common working SQL (continuous update)
2022-06-26 18:42:00 【JobsTribe】
Summarize the commonly used sql.
Get the current time in milliseconds
be used CURRENT_TIMESTAMP(3).
select CURRENT_TIMESTAMP(3);
However, when specifying fields, you need to note that the field type also needs to datatime(3) type .
In the field type ,datetime(3) It is accurate to the millisecond level ,datetime The default is 0, Accurate to the second level .
How to count the total number of interface calls ?
use group by, Such as
SELECT
service,
app_key,
count(*)
FROM
trace_log t
WHERE
create_time BETWEEN '2020-04-01 00:00'
AND '2020-05-01 00:00'
GROUP BY
service,
app_key;
The number of entries in the statistical table exceeds 2 Data for
With aggregate functions having
SELECT
service,
app_key
FROM
aa
GROUP BY
service
HAVING
count( * ) > 1;
Query second place
Use the less than sign , This will rule out null
SELECT
max( VALUE )
FROM
customer
WHERE
VALUE
< ( SELECT max( VALUE ) FROM customer );
边栏推荐
猜你喜欢
随机推荐
8VC Venture Cup 2017 - Final Round C. Nikita and stack
(树) 树状数组
最小生成树、最短路径、拓扑排序、关键路径
元宇宙链游开发案例版 NFT元宇宙链游系统开发技术分析
Résumé des points de connaissance
sql 中的alter操作总结
JSONUtils工具类(基于alibaba fastjson)
预编译处理指令中的条件编译
JVM入个门(1)
DAPP丨LP单双币流动性质押挖矿系统开发原理分析及源码
Project practice 6: distributed transaction Seata
Using cache in vuex to solve the problem of data loss in refreshing state
NFTGameFi链游系统开发详解方案丨链游系统开发原理解析
品达通用权限系统(Day 1~Day 2)
Solidity - contract inheritance sub contract contains constructor errors and one contract calls the view function of another contract to charge gas fees
VCD video disc
Nftgamefi chain game system development detailed solution - chain game system development principle analysis
转:苹果CEO库克:伟大的想法来自不断拒绝接受现状
The eigen library calculates the angle between two vectors
Xlua get button registration click event of ugui









