MySQL 手机选号(AABB、ABCD、DCBA、AAA),SQL SERVER 手机选号(AABB、ABCD、DCBA、AAA),通过规则查询靓号

这篇具有很好参考价值的文章主要介绍了MySQL 手机选号(AABB、ABCD、DCBA、AAA),SQL SERVER 手机选号(AABB、ABCD、DCBA、AAA),通过规则查询靓号。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

先上SQL SERVER:

create table plat_uidlist(Uidd varchar(15) , Areaid int , State int)
 
insert into plat_uidlist values('2335435' ,8 ,0 )
insert into plat_uidlist values('2335436' ,8 ,1 )
insert into plat_uidlist values('2335437' ,2 ,2 )
insert into plat_uidlist values('2335438' ,8 ,3 )
insert into plat_uidlist values('2335439' ,3 ,0 )
insert into plat_uidlist values('2335440' ,8 ,0 )
insert into plat_uidlist values('6677889' ,8 ,0 )
insert into plat_uidlist values('1234578' ,4 ,0 )
insert into plat_uidlist values('4980010' ,8 ,0 )
insert into plat_uidlist values('4980099' ,8 ,0 )
 
 
 
--如何查询test值3位尾数以上是一样的,如尾数是8888,7777,888,777
select *
from plat_uidlist
where replicate(RIGHT(Uidd,1),3)=RIGHT(Uidd,3)
 
 
select * from plat_uidlist where abs(RIGHT(Uidd,2)*1-LEFT(RIGHT(Uidd,4),2)*1)=22
 
-- 后4位ABCD或者DCBA
select * from plat_uidlist where abs(RIGHT(Uidd,4-1)*1-LEFT(RIGHT(Uidd,4),4-1)*1)=REPLICATE(1,4-1)
-- 后5位ABCDE或者EDCBA
select * from plat_uidlist where abs(RIGHT(Uidd,5-1)*1-LEFT(RIGHT(Uidd,5),5-1)*1)=REPLICATE(1,5-1)
 
--如何查询test值4位尾数是AABB,如8877,7766,6677
SELECT * FROM 
(SELECT Uidd,A = RIGHT(Uidd,1), 
B= LEFT(RIGHT(Uidd,2),1),C = LEFT(RIGHT(Uidd,3),1),D = LEFT(RIGHT(Uidd,4),1) FROM plat_uidlist )E
WHERE  (E.A = E.B ) AND (E.C = E.D )  AND (E.A <> E.C) 
 
--如何查询test值4位以上尾数是顺序的,如87654321、1234567、1234、4321?
SELECT * FROM 
(SELECT Uidd,A = RIGHT(Uidd,1), B= LEFT(RIGHT(Uidd,2),1),C = LEFT(RIGHT(Uidd,3),1),D = LEFT(RIGHT(Uidd,4),1) FROM plat_uidlist )E
WHERE  (E.A = E.B + 1) AND (E.B = E.C + 1)  AND (E.C = E.D + 1) 
        OR ((E.A = E.B - 1) AND (E.B = E.C - 1)  AND (E.C = E.D - 1))
        
--如何查询test值3位尾数以上是一样的,如尾数是8888,7777,888,777?
SELECT * FROM 
(SELECT Uidd,A = RIGHT(Uidd,1), B= LEFT(RIGHT(Uidd,2),1),C = LEFT(RIGHT(Uidd,3),1) FROM plat_uidlist )D
WHERE  D.A = D.B AND D.A = D.C  AND D.B = D.C
 
-- 三连号AAA或者以上(AAAA、AAAAA),第四位起的任意位置
select * from
(select tel_no,A = right(left(tel_no,4),1),B = right(left(tel_no,5),1),C = right(left(tel_no,6),1),D = right(left(tel_no,7),1),
E = right(left(tel_no,8),1),F = right(left(tel_no,9),1),G = right(left(tel_no,10),1),H = right(left(tel_no,11),1) 
from stureg.dbo.t_tel_info) TMP
where (TMP.A = TMP.B AND TMP.A = TMP.C AND TMP.B = TMP.C) 
OR (TMP.B = TMP.C AND TMP.B = TMP.D AND TMP.C = TMP.D)
OR (TMP.C = TMP.D AND TMP.C = TMP.E AND TMP.D = TMP.E)
OR (TMP.D = TMP.E AND TMP.D = TMP.F AND TMP.E = TMP.F)
OR (TMP.E = TMP.F AND TMP.E = TMP.G AND TMP.F = TMP.G)
OR (TMP.F = TMP.G AND TMP.F = TMP.H AND TMP.G = TMP.H)
 
-- AABB,第四位起任意位置
select * from
(select tel_no,A = right(left(tel_no,4),1),B = right(left(tel_no,5),1),C = right(left(tel_no,6),1),D = right(left(tel_no,7),1),
E = right(left(tel_no,8),1),F = right(left(tel_no,9),1),G = right(left(tel_no,10),1),H = right(left(tel_no,11),1) 
from stureg.dbo.t_tel_info) TMP
where (TMP.A = TMP.B AND TMP.C = TMP.D AND TMP.B != TMP.C) 
OR (TMP.B = TMP.C AND TMP.D = TMP.E AND TMP.C != TMP.D)
OR (TMP.C = TMP.D AND TMP.E = TMP.F AND TMP.D != TMP.E)
OR (TMP.D = TMP.E AND TMP.F = TMP.G AND TMP.E != TMP.F)
OR (TMP.E = TMP.F AND TMP.G = TMP.H AND TMP.F != TMP.G)
 
-- ABCD(ABCDE、ABCDEF)或以上,第四位起任意位置
select * from
(select tel_no,A = right(left(tel_no,4),1),B = right(left(tel_no,5),1),C = right(left(tel_no,6),1),D = right(left(tel_no,7),1),
E = right(left(tel_no,8),1),F = right(left(tel_no,9),1),G = right(left(tel_no,10),1),H = right(left(tel_no,11),1) 
from stureg.dbo.t_tel_info) TMP
where (TMP.A+1 = TMP.B AND TMP.B+1 = TMP.C AND TMP.C+1 = TMP.D)
OR (TMP.B+1 = TMP.C AND TMP.C+1 = TMP.D AND TMP.D+1 = TMP.E)
OR (TMP.C+1 = TMP.D AND TMP.D+1 = TMP.E AND TMP.E+1 = TMP.F)
OR (TMP.D+1 = TMP.E AND TMP.E+1 = TMP.F AND TMP.F+1 = TMP.G)
OR (TMP.E+1 = TMP.F AND TMP.F+1 = TMP.G AND TMP.G+1 = TMP.H)
 
-- DCBA或以上,第四位起任意位置
select * from
(select tel_no,A = right(left(tel_no,4),1),B = right(left(tel_no,5),1),C = right(left(tel_no,6),1),D = right(left(tel_no,7),1),
E = right(left(tel_no,8),1),F = right(left(tel_no,9),1),G = right(left(tel_no,10),1),H = right(left(tel_no,11),1) 
from stureg.dbo.t_tel_info) TMP
where (TMP.A-1 = TMP.B AND TMP.B-1 = TMP.C AND TMP.C-1 = TMP.D)
OR (TMP.B-1 = TMP.C AND TMP.C-1 = TMP.D AND TMP.D-1 = TMP.E)
OR (TMP.C-1 = TMP.D AND TMP.D-1 = TMP.E AND TMP.E-1 = TMP.F)
OR (TMP.D-1 = TMP.E AND TMP.E-1 = TMP.F AND TMP.F-1 = TMP.G)
OR (TMP.E-1 = TMP.F AND TMP.F-1 = TMP.G AND TMP.G-1 = TMP.H)

然后上mysql的文章来源地址https://www.toymoban.com/news/detail-647510.html

<sql id="AAA">
        select *
        from zb_lucky_number_pool
        where REPEAT(RIGHT(lucky_number,1),3)=RIGHT(lucky_number,3)
    </sql>
    <sql id="AAAA">
        select *
        from zb_lucky_number_pool
        where REPEAT(RIGHT(lucky_number,1),4)=RIGHT(lucky_number,4)
    </sql>
    <sql id="AAAAA">
        select *
        from zb_lucky_number_pool
        where REPEAT(RIGHT(lucky_number,1),5)=RIGHT(lucky_number,5)
    </sql>
    <sql id="AAAAAA">
        select *
        from zb_lucky_number_pool
        where REPEAT(RIGHT(lucky_number,1),6)=RIGHT(lucky_number,6)
    </sql>
    <sql id="AAAAAAA">
        select *
        from zb_lucky_number_pool
        where REPEAT(RIGHT(lucky_number,1),7)=RIGHT(lucky_number,7)
    </sql>
    <sql id="ABAB">
        SELECT * FROM
        (SELECT *, RIGHT(lucky_number,1) AS A,
        LEFT(RIGHT(lucky_number,2),1) AS B,LEFT(RIGHT(lucky_number,3),1) AS C , LEFT(RIGHT(lucky_number,4),1) AS D FROM zb_lucky_number_pool )E
        WHERE  (E.A = E.C ) AND (E.B = E.D )  AND (E.A != E.B)
    </sql>
    <sql id="ABABAB">
        SELECT * FROM
            (SELECT *, RIGHT(lucky_number,1) AS A,
                 LEFT(RIGHT(lucky_number,2),1) AS B,LEFT(RIGHT(lucky_number,3),1) AS C , LEFT(RIGHT(lucky_number,4),1) AS D, LEFT(RIGHT(lucky_number,5),1) AS E, LEFT(RIGHT(lucky_number,6),1) AS F
             FROM zb_lucky_number_pool )G
        WHERE  (G.A = G.C ) AND (G.B = G.D ) AND (G.A = G.E )  AND (G.B = G.F )AND (G.A != G.B)
    </sql>
    <sql id="AABB">
        SELECT * FROM
        (SELECT *, RIGHT(lucky_number,1) AS A,
        LEFT(RIGHT(lucky_number,2),1) AS B,LEFT(RIGHT(lucky_number,3),1) AS C , LEFT(RIGHT(lucky_number,4),1) AS D FROM zb_lucky_number_pool )E
        WHERE  (E.A = E.B ) AND (E.C = E.D )  AND (E.A != E.C)
    </sql>
    <sql id="AABBCC">
        SELECT * FROM
        (SELECT *, RIGHT(lucky_number,1) AS A,
        LEFT(RIGHT(lucky_number,2),1) AS B,LEFT(RIGHT(lucky_number,3),1) AS C , LEFT(RIGHT(lucky_number,4),1) AS D
        , LEFT(RIGHT(lucky_number,5),1) AS E
        , LEFT(RIGHT(lucky_number,6),1) AS F
        FROM zb_lucky_number_pool )G
        WHERE  (G.A = G.B ) AND (G.C = G.D ) AND (G.E = G.F ) AND (G.A != G.C)  AND (G.A != G.E) AND (G.C != G.E)
    </sql>
    <sql id="AAABBB">
        SELECT * FROM
            (SELECT *, RIGHT(lucky_number,1) as A, LEFT(RIGHT(lucky_number,2),1) AS B, LEFT(RIGHT(lucky_number,3),1) AS C
                     , LEFT(RIGHT(lucky_number,4),1) AS D
                     , LEFT(RIGHT(lucky_number,5),1) AS E
                     , LEFT(RIGHT(lucky_number,6),1) AS F
             FROM zb_lucky_number_pool )G
        WHERE  G.A = G.B  AND G.B = G.C  AND G.D = G.E AND G.E = G.F AND G.A != G.D
    </sql>
    <sql id="ABC">
        select * from zb_lucky_number_pool where abs(RIGHT(lucky_number,3-1)*1-LEFT(RIGHT(lucky_number,3),3-1)*1)=REPEAT(1,3-1)
    </sql>
    <sql id="ABCD">
        select * from zb_lucky_number_pool where abs(RIGHT(lucky_number,4-1)*1-LEFT(RIGHT(lucky_number,4),4-1)*1)=REPEAT(1,4-1)
    </sql>
    <sql id="ABCDE">
        select * from zb_lucky_number_pool where abs(RIGHT(lucky_number,5-1)*1-LEFT(RIGHT(lucky_number,5),5-1)*1)=REPEAT(1,5-1)
    </sql>
    <sql id="ABCDEF">
        select * from zb_lucky_number_pool where abs(RIGHT(lucky_number,6-1)*1-LEFT(RIGHT(lucky_number,6),6-1)*1)=REPEAT(1,6-1)
    </sql>
    <sql id="ABCABC">
        SELECT * FROM
            (SELECT *, RIGHT(lucky_number,1) as A, LEFT(RIGHT(lucky_number,2),1) AS B, LEFT(RIGHT(lucky_number,3),1) AS C
                     , LEFT(RIGHT(lucky_number,4),1) AS D
                     , LEFT(RIGHT(lucky_number,5),1) AS E
                     , LEFT(RIGHT(lucky_number,6),1) AS F
             FROM zb_lucky_number_pool )G
        WHERE  G.A = G.D  AND G.B = G.E  AND G.C = G.F AND abs(G.A - G.B) = 1 AND abs(G.B - G.C) = 1
    </sql>
    <sql id="ABCDABCD">
        SELECT * FROM
            (SELECT *, RIGHT(lucky_number,1) as A, LEFT(RIGHT(lucky_number,2),1) AS B, LEFT(RIGHT(lucky_number,3),1) AS C
                     , LEFT(RIGHT(lucky_number,4),1) AS D
                     , LEFT(RIGHT(lucky_number,5),1) AS E
                     , LEFT(RIGHT(lucky_number,6),1) AS F
                     , LEFT(RIGHT(lucky_number,7),1) AS G
                     , LEFT(RIGHT(lucky_number,8),1) AS H
             FROM zb_lucky_number_pool ) Z
        WHERE  Z.A = Z.E  AND Z.B = Z.F  AND Z.C = Z.G AND Z.D = Z.H AND abs(Z.A - Z.B) = 1 AND abs(Z.B - Z.C) = 1 AND abs(Z.C - Z.D) = 1
    </sql>
    <sql id="520">
        select * from zb_lucky_number_pool where lucky_number REGEXP '520$'
    </sql>
    <sql id="1314">
        select * from zb_lucky_number_pool where lucky_number REGEXP '1314$'
    </sql>
    <sql id="5201314">
        select * from zb_lucky_number_pool where lucky_number REGEXP '5201314$'
    </sql>

到了这里,关于MySQL 手机选号(AABB、ABCD、DCBA、AAA),SQL SERVER 手机选号(AABB、ABCD、DCBA、AAA),通过规则查询靓号的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【Sql Server】通过Sql语句批量处理数据,使用变量且遍历数据进行逻辑处理

    欢迎来到《小5讲堂》,大家好,我是全栈小5。 这是《Sql Server》系列文章,每篇文章将以博主理解的角度展开讲解, 特别是针对知识点的概念进行叙说,大部分文章将会对这些概念进行实际例子验证,以此达到加深对知识点的理解和掌握。 温馨提示:博主能力有限,理解水

    2024年03月15日
    浏览(45)
  • 通过空间占用和执行计划了解SQL Server的行存储索引

    索引是一种帮助查询语句能够快速定位到数据的一种技术。索引的存储方式有行存储索引、列存储索引和内存优化三种存储方式: 行存储索引,使用B+树结构,行存储指的是数据存储格式为堆、聚集索引和内存优化表的表,用于OLTP场景。行存储索引按顺序排列的值列表,每个

    2024年02月04日
    浏览(84)
  • Python 通过pymssql访问查询操作 SQL Server数据库

    在企业应用开发中,经常用到应用程序访问数据库的开发模式,中小企业使用的数据库中,以ms SQL Server居多。本文就以一个简单的实例模型,简单介绍一下python访问ms sql sever数据库的方法。 本文中以下面的本地SQL Server数据库为例进行数据库连接,数据表的查询、增加、删除

    2024年02月10日
    浏览(92)
  • DATAGRIP连接Microsoft SQL Server异常:驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接

    在某次更新Microsoft SQL连接驱动后,出现了连接异常: [08S01] 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”。 ClientConnectionId:aa01

    2024年02月13日
    浏览(57)
  • SQL Server安装提示安装程序无法通过windows update服务搜索更新

    安装 SQL Server 时提示: SQL Server 安装程序遇到以下错误: 安装程序在运行作业 UpdateResult 时失败。 错误代码 0x876E0003。 开启 Windows 自动更新或关闭自动更新、不勾选 “使用 Microsoft Update 检查更新(推荐)” 均 无法继续安装 解决方法: 手动创建 DefaultSetup.ini 放置到安装程序文

    2024年02月11日
    浏览(41)
  • Sql server 连接 MySQL

    工具下载 链接:https://pan.baidu.com/s/1729J2ZI8Ov553i1CcVhhmQ 提取码:crjd –来自百度网盘超级会员V5的分享 1.安装vcredist_x64驱动 2.安装mysql-connector-odbc-5.3.14-winx64驱动 3.安装好后,在管理工具-ODBC数据源-系统DSN-添加-选择 MYSQL ODBC 5.3 Unicode DRIVER-完成 Data Source Name:数据源名称 Decription:描述

    2024年02月08日
    浏览(53)
  • idea 中无法连接 sql server 数据库,报错:驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接

    上面的代码报错如下: 在dbURL中把;trustServerCertificate=true加上后就没有报错了 无报错 因为sql server在jdbc连接的时候需要一定的安全验证,只需要在dbURL中把;trustServerCertificate=true加上后令其跳过就行了

    2024年02月12日
    浏览(51)
  • 数据库实验——通过SQL Server Management Studio创建及管理数据库

    (1)熟悉SQL Server Management Studio。 (2)掌握通过SQL Server Management Studio管理数据库的方法。 (3)掌握数据库及其物理文件的结构关系。 (4)掌握通过SQL Server Management Studio管理数据表的方法。 1.通过SQL Server Management Studio创建数据库 创建一个名称为学生管理信息Student_info数

    2024年02月08日
    浏览(62)
  • Mysql 和Sql Server的区别

    开发商:MySQL由Oracle公司开发,而SQL Server由Microsoft公司开发。 操作系统支持:MySQL可以在多个操作系统上运行,包括Linux、Windows、macOS等,而SQL Server只能在Windows操作系统上运行。 许可协议:MySQL使用GPL(GNU通用公共许可证)许可证,这意味着开发人员可以免费获得MySQL的源代

    2024年02月13日
    浏览(53)
  • MySQL 、Sql server 错误处理机制

    sql server 错误处理机制 try 。。。catch MySQL 程序错误处理机制 ** 定义条件 + 定义处理程序** 定义条件: declare 错误名称 condition for {数值型错误码 | sqlstate ’字符串类错误代码‘} 错误码的说明: MySQL_error_code 和 sqlstate_value 都可以表示MySQL的错误 MySQL_error_code : 是数值型错误代

    2024年02月12日
    浏览(30)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包