
数据库
分享code的快乐
华少哥
wander wander wander……
展开
-
sql server分页语句写法
使用 row_number() 关键字分页 select top pageSize * from (select row_number() over(order by uId asc) as rownumber,* from userInfo) temp_row where rownumber>((pageIndex-1)*pageSize) 使用 offset /fetch next 分页 select * from userInfo order by uId offset ((p.原创 2021-03-15 15:27:00 · 363 阅读 · 0 评论 -
MySQL通过经纬度计算定位的距离
SELECT ROUND( 6378.138 * 2 * ASIN( SQRT( POW( SIN( ( 定位的lat * PI() / 180 - S_lat * PI() / 180 ) / 2原创 2021-03-10 10:53:47 · 237 阅读 · 0 评论 -
SQL Server常用函数大全集
字符串函数 包含查询函数 charindex ( expression1 , expression2 [,start_location ]) -- 在2中寻找包含的字符1的位置,start_location可指定开始查询位置,未找到返回 0 -- 一般用于分销系统查询用户推荐人关系列的情况 select charindex(','+ cast(123 as VARCHAR)+',','0,123,444,5323,2353,',0) patindex ('%CDE%','ABCDEFGHIJK') --原创 2020-05-20 14:03:14 · 257 阅读 · 0 评论 -
SQL Server常用式语句
分页 select * from ( SELECT pr.*,ROW_NUMBER() OVER(ORDER BY pr.id desc) as xuhao from C_product as pr INNER join C_type as ty on ty.id = pr.typeId where ty.is_jf = 1 ) t1 where t1.xuhao BETWEEN 0 and 10 -- 先在子查询把需要的数据查出来,并把查出的数据用ROW_NUMBER() OVER(原创 2020-05-20 10:33:43 · 152 阅读 · 0 评论 -
MySQL 函数大全集
加密函数 AES_ENCRYPT(字符串,秘钥) ##加密函数 AES_DECRYPT(字符串,秘钥) ##解密函数 ## 加密解密需要相互转换进制 HEX() 二进制转十六进制 UNHEX() 十六进制转 二进制 select HEX(AES_ENCRYPT('你好世界','ABC123456')) select AES_DECRYPT(UNHEX('E85A104B6142A7375E53C0545CAD48EE'),'ABC123456') ...原创 2020-05-20 10:20:52 · 109 阅读 · 0 评论