SQL在线美化工具

在处理SQL语句查询的时候,往往会遇到复杂、阅读不友好的语句。

冗余嵌套的语法结构、混乱的缩进格式以及非标准化的关键字书写方式,不仅会显著增加代码解读的时间成本,更会导致团队协作效率下降与潜在错误风险的累积。

为解决这一问题,我专门开发了一个可在线美化SQL的工具,可将杂乱的SQL脚本转化为符合ANSI/ISO标准的可读性代码,使开发人员能够更高效地进行语句调试与版本维护工作。

未美化前:

SELECT DATE_FORMAT(b.t_create, '%Y-%c-%d') dateID, b.title memo

FROM (SELECT id FROM orc_scheme_detail d WHERE d.business=208

AND d.type IN (29,30,31,321,33,34,3542,361,327,38,39,40,41,42,431,4422,415,4546,47,48,'a',

29,30,31,321,33,34,3542,361,327,38,39,40,41,42,431,4422,415,4546,47,48,'a')

AND d.title IS NOT NULL AND t_create >=

DATE_FORMAT((DATE_SUB(NOW(),INTERVAL 1 DAY)),'%Y-%c-%d') AND t_create

< DATE_FORMAT(NOW(), '%Y-%c-%d') ORDER BY d.id LIMIT 2,10) a,

orc_scheme_detail b WHERE a.id = b.id

美化后:

SELECT
  DATE_FORMAT(b.t_create, '%Y-%c-%d') dateID,
  b.title memo
FROM
  (
    SELECT
      id
    FROM
      orc_scheme_detail d
    WHERE
      d.business = 208
      AND d.type IN (
        29, 30, 31, 321, 33, 34, 3542, 361, 327,
        38, 39, 40, 41, 42, 431, 4422, 415, 4546,
        47, 48, 'a', 29, 30, 31, 321, 33, 34, 3542,
        361, 327, 38, 39, 40, 41, 42, 431, 4422,
        415, 4546, 47, 48, 'a'
      )
      AND d.title IS NOT NULL
      AND t_create >= DATE_FORMAT(
        (
          DATE_SUB(NOW(), INTERVAL 1 DAY)
        ),
        '%Y-%c-%d'
      )
      AND t_create < DATE_FORMAT(NOW(), '%Y-%c-%d')
    ORDER BY
      d.id
    LIMIT
      2, 10
  ) a,
  orc_scheme_detail b
WHERE
  a.id = b.id

页面效果展示:
在这里插入图片描述
在这里插入图片描述

SQL代码美化程序 SQL Pretty Printer 3.2.8 Copyright 2005-2011, Gudu Software. All Rights Reserved http://www.dpriver.com -------------------------------------------------------- Overview -------- SQL Pretty Printer is a tool that will help you beautify your SQL code. Using hotkey functionality, SQL Pretty Printer can reformat SQL statements for a wide variety of database tools such as Microsoft Query Analyzer, SQL Server Management Studio (SSMS), TOAD and PL/SQL Developer, development environments such as Visual Studio 2003/2005/2008 and Eclipse, and popular editors such as UltraEditor and EditPlus. In addition to beautifying SQL code, SQL Pretty Printer can translate SQL code into C#, Java, PHP, DELPHI and other program languages. SQL Pretty Printer also includes command line functionality, with the ability to format single files, single directories and multiple directories. SQL Pretty Printer is designed to deal with the syntax used by most popular database systems including Microsoft SQL Server, Oracle, IBM DB2, MySQL and Microsoft Access (Informix, Sybase, and PostgreSQL support is currently in development). Output conforms to most of the entry level SQL99 Standard. Add-Ins for SSMS and Visual Studio 2003/2005/2008/2011 are available. APIs for dotnet and COM version are available. features: ** Beautifies SQL statements utilizing highly customizable format options. ** Formats SQL on-the-fly in popular tools and editors using hotkey functionality. ** Minimizes to the system tray for quick access. ** Includes a command line for batch conversion of single files, single directories or directory trees (use the command line API in your own program!) ** Verifies SQL syntax with detailed error information. ** Converts monochrome SQL code into colorful RTF document. ** Converts monochrome SQL code into colorful HTML for easy placement in blogs and forums. ** Converts SQL to various programming languages including C#, Java, DELPHI, PHP and others. ** Currently supports SQL syntax for Microsoft SQL Server, Oracle, IBM DB2, MySQL and Microsoft Access (Informix, Sybase, and PostgreSQL support is currently in development). ** Add-In for SQL Server Management Studio available. ** Add-In for Visual Studio 2003/2005/2008 available. Requirements ------------ Pentium class CPU or higher Windows 95/98/NT/2000/XP/Vista/win7
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值