SQL Formatter

The SQL Formatter helps in formatting SQL statements.

Enter your SQL
If you use this great tool then please comment and/or like this page.
Average Rating:     Tool Views: 2.5k

Is this tool helpful?
How can we improve it?

Subscribe for Latest Tools


How to use this SQL Formatter Tool?



Online SQL Formatter Example

Below is an example of the original SQL Formatter and the result.

Original SQL Formatter Example
 /* CREATE TABLE */
CREATE TABLE IF NOT EXISTS TABLE_NAME(
album VARCHAR( 100 ),
year DECIMAL( 10 , 2 ),
US_peak_chart_post VARCHAR( 100 )
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'The White Stripes', 1999,' -'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'De Stijl', 2000,' -'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'White Blood Cells', 20.01,' 61'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Elephant', 2003,' 6'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Get Behind Me Satan', 2005,' 3'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Icky Thump', 2007,' 2'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Under Great White Northern Lights', 2010,' 11'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Live in Mississippi', 2011,' -'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Live at the Gold Dollar', 2012,' -'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Nine Miles from the White City', 2013,' -'
);

And an example of how the online SQL Formatter works.

SQL Formatter Result
 /* CREATE TABLE */
CREATE TABLE IF NOT EXISTS TABLE_NAME(
album VARCHAR( 100 ),
year DECIMAL( 10 , 2 ),
US_peak_chart_post VARCHAR( 100 )
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'The White Stripes', 1999,' -'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'De Stijl', 2000,' -'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'White Blood Cells', 20.01,' 61'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Elephant', 2003,' 6'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Get Behind Me Satan', 2005,' 3'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Icky Thump', 2007,' 2'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Under Great White Northern Lights', 2010,' 11'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Live in Mississippi', 2011,' -'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Live at the Gold Dollar', 2012,' -'
);

/* INSERT QUERY */
INSERT INTO TABLE_NAME( album,year,US_peak_chart_post )
VALUES
(
    'Nine Miles from the White City', 2013,' -'
);

How to use Yttags's SQL Formatter?

  • Step 1: Select the Tool
SQL Formatter Step 1
  • Step 2: paste your SQL text into the textbox And Press The Format SQL Button And Check Your SQL Formatter Result
SQL Formatter Step 2

If you want to link to Sql Formatter page, please use the codes provided below!

Sql Formatter

FAQs for SQL Formatter

What is SQL formatter?
An SQL formatter is a tool or software that automatically arranges and formats SQL code to improve readability and consistency, making it easier for developers to understand and work with database queries.
How to read SQL format?
To read SQL code effectively, follow a structured approach: understand the SELECT clauses, table names, conditions, and JOINs, then analyze the query flow to grasp its purpose and data manipulation.
How to convert string to date SQL?
In SQL, you can convert a string to a date using the CONVERT or CAST function, like this:
code:
CONVERT(DATE, your_string_date, desired_format)
Replace your_string_date with the string to convert and desired_format with the appropriate date format code.
How to use SQL formatter in VS Code?
In VS Code, you can use an extension like "SQL Server (mssql)" or "SQLTools" to format SQL code. Install the extension, open a SQL file, and use the formatting option (often Ctrl + K, Ctrl + F) to format your code.
How to format SQL numbers?
To format SQL numbers, you can use the FORMAT function, specifying the desired format pattern. For example:
code :
SELECT FORMAT(your_number, 'N2') AS formatted_number;
This formats your_number with two decimal places. Adjust the format pattern as needed.