
sql
biany2
这个作者很懒,什么都没留下…
展开
-
Mysql 排名和名次问题
今天在力扣看到一道sql问题,链接https://leetcode-cn.com/problems/rank-scores/讲的是如何根据分数排名,官网显示中等难度。大概看了3种解决方法。方法1,参考oracle用窗口函数,本地调试,不支持方法2,用自关联查询的方式,官方显示是正确答案,本人亲测,在12w行数据里面跑,240秒没有跑完select a.Score as Sco...原创 2019-12-24 11:49:43 · 1070 阅读 · 1 评论 -
数据库group by过滤
数declare @checkTime datetime, @intervarTime int set @checkTime = '2010-1-1 11:11:51' set @intervarTime =5select dateadd(ss, -(DATEPART(ss, @checkTime ) % 60), @checkTi原创 2014-07-17 11:50:22 · 968 阅读 · 0 评论 -
存储过程里面包含in的问题
set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOALTER procedure [dbo].[query_all_alarm_history]@userCode varchar(5),@startTime datetime,@endTime datetime,@alarmIds varchar(50)asSELECT UsersI原创 2014-10-11 16:36:53 · 689 阅读 · 0 评论 -
sql 一些特殊技巧
-------------获取时间段内表列 select name as tableName from [dbo].sysobjects where type='U' and (SUBSTRING(name,12,20) >= '20150622' and SUBSTRING(name,12,20) <= '20150626')原创 2015-07-24 16:27:26 · 449 阅读 · 0 评论 -
db2 工具直接解锁表
CALL SYSPROC.ADMIN_CMD('reorg table t1');原创 2017-09-29 11:14:37 · 1720 阅读 · 0 评论