SQL Formatter

The Online SQL Formatter can be used to quickly format SQL into a more readable output. More.

We depend on ads to keep our content free for you.
Please consider disabling your ad blocker.

This is a client-side utility. Your data will NOT leave your own browser.
Copy shareable link is limited to 5,000 characters as it uses a client-side feature.

How it works?

SQL Formatter online: The Online SQL Formatter can be used to quickly format SQL into a more readable output.

  • 2, 3 and 4 Spaces and Tabs: Formats the input using a specified level of indentation.

See the examples of usage below.

Examples

Unformatted SQL
SELECT FIRST_NAME, LAST_NAME, PHONE, ADDRESS FROM CUSTOMER WHERE FIRST_NAME LIKE '%John%' ORDER BY FIRST_NAME
Formatted SQL
    SELECT
        FIRST_NAME,
        LAST_NAME,
        PHONE,
        ADDRESS 
    FROM
        CUSTOMER 
    WHERE
        FIRST_NAME LIKE '%John%' 
    ORDER BY
        FIRST_NAME

Tutorials

How to format SQL

Follow these steps to format your SQL statement.
  1. Prepare your SQL input
    • Have your SQL input ready to be used.
  2. Enter the SQL input
    • Paste your SQL into the input area.
  3. Select the formatting option
    • Select the desired option and click "Submit".
  4. All done
    • Your formatted SQL is ready. Click the "Copy to Clipboard" button, and you should be ready to rock!

More information

Structured Query Language or simply SQL is the default language used for querying and managing the data in a Relational Database Management System (RDBMS).

SQL language is consisted by a Data Definition Language (DDL), which is used to create the structure of the relational databases, and a Data Manipulation Language (DML), which is used to manipulate the data. See below some examples of SQL keywords used with each concept.

Data Definition Language (DDL):

  • CREATE
  • ALTER
  • DROP
  • TRUNCATE
  • And more

The following is an example of statement using DDL, where a new table called records is defined:

CREATE TABLE records (id INT, description VARCHAR(255));

Data Manipulation Language (DML):

  • SELECT
  • INSERT
  • UPDATE
  • DELETE
  • And more

The following is an example of statement using DML, where all records from the table records are retrieved:

SELECT * FROM records;

You can find more information about SQL in the following resources.

This tool does not validate your SQL input. It will just identify specified keywords and perform the appropriate formatting.

Additional Resources

Looking for something else?

In case you are looking for something else than this functionality, please let us know by contacting us. The most common requests will be made available (for free) once possible.