Hongmu Notes

🗄️ SQL formatting

Beautify or compress SQL statements with one click and replace content in place.

SQL formatting

Instructions for use

  • Paste SQL into the input box and click "Format SQL" or "Compress SQL"
  • The result will be written back to the input box on the spot. It is recommended to make a backup copy of the original text first.
  • Formatting only adjusts whitespace and line breaks, but does not change the statement itself.

SQL compression

When putting SQL into code or configuration, redundant line breaks often make the layout confusing; it is easiest to press it into one line.

📌 Will compression cause content loss?

No. Only line breaks, tabs and extra spaces are removed, and the contents of statements and comments are retained; spaces in the string will not be deleted.

🔒 Dealing with location and privacy

Formatting and compression are completed locally in the browser. There is no Internet access, no uploading, and no writing to local storage. It will be cleared after refreshing. SQL often contains table names and field names. Please save the results according to internal specifications, and it is recommended to paste only necessary statement fragments for processing.

📌 Processing rules

For formatting, the local SQL formatting library on the site is called: line breaks are rearranged according to keywords and bracket structures such as SELECT, FROM, WHERE, JOIN, GROUP BY, etc., and the indentation is uniformly four spaces; for compression, the local compression library on the site removes line breaks, tabs, and extra spaces, and puts the statements back into one line. Both do not rewrite identifiers, strings, and comment contents; if the statement syntax is incomplete, the formatting library may give a parsing failure prompt, and the content of the input box remains unchanged.

All keywords and tutorials 12

❓ FAQ

Can it still be read after compression?
Not suitable for human reading. It is recommended to keep a separate copy of the beautified version.
Can I just delete the new line?
The compression of this page will also remove excess spaces. This is a fixed behavior of the compression library.
SQL compression usage scenarios
Paste the code string, write it into the work order, and put it into the monitoring configuration.