sql-prettier

Formats whitespaces in a SQL query to make it more readable

Usage no npm install needed!

<script type="module">
  import sqlPrettier from 'https://cdn.skypack.dev/sql-prettier';
</script>

README

SQL Prettier fork from Sql Formatter

Install

Get the latest version from NPM:

npm install sql-prettier

Usage

import sqlPrettier from 'sql-prettier';

console.log(sqlPrettier.format('SELECT supplier_name, city FROM suppliers WHERE supplier_id > 500'));

This will output:

SELECT  supplier_name,
        city
FROM    suppliers
WHERE   supplier_id > 500