
sql
拉风的超人
专注、专心
展开
-
MySQL重置ID起始值
使用步骤1.方法一,执行SQL:代码如下(示例):truncate table test; (这里假定你的表名test)这种方法好处是运行速度超快2.方法二,执行如下SQL: (还是假定表名是test)代码如下(示例):delete from test;alter table `test` auto_increment=1;这种方法好处是可以从任何值开始,缺点是如果数据量大的话delete from test;非常耗时...原创 2020-11-18 10:22:37 · 562 阅读 · 0 评论 -
sql查询时间大于12个小时的记录
1.sql查询时间大于12个小时的记录代码如下(示例):SELECT * from 表名wherenow() > ADDDATE(时间字段, INTERVAL 12 HOUR)原创 2020-11-18 10:17:32 · 3038 阅读 · 0 评论 -
sql查询按两个字段查询重复记录
1.sql查询按两个字段查询重复记录代码如下(示例):select * from 表名 awhere a.字段1 in (select 字段1 from 表名 group by 字段1,字段2 having count(*) > 1) and a.字段2 in (select 字段2 from 表名 group by 字段1 ,字段2 having count(*) > 1)...原创 2020-11-18 10:13:09 · 9161 阅读 · 0 评论