摘要:
另一篇文章SQLServer中批量插入数据方式的性能对比declare @i intdeclare @qid intset @i=1set @qid=100while @i<50000begininsert into Order(orderid,ordername) values(@qid,'订单名称')set @i=@i+1set @qid=@qid+1end海量语句查询代码优化:具体要注意的:1.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索引而进行全表扫描,如:select id from t where num is nul 阅读全文
摘要:
1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断select * from peoplewhere peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1) 2、删除表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断,只留有rowid最小... 阅读全文