SQLFormatter
FormatterConvertPricingDocsGet Pro
Formatter · Redshift

Format Redshift SQL online

Reformat Redshift queries against Redshift's own grammar: consistent indentation, aligned clauses and uppercase keywords. Paste one-line or ORM-generated SQL and get structured, reviewable output.

1Paste your Redshift query into the editor.
2Press Format — or ⌘↵.
3Copy clean, highlighted SQL.
Open formatter
before
select s.user_id,listagg(s.event,',')within group(order by s.ts) as events,count(*) n from sessions s where s.ts>dateadd(day,-7,getdate()) group by s.user_id having count(*)>3 order by n desc limit 500;
Redshift
SELECT
  s.user_id,
  listagg(s.event, ',') within GROUP (
    ORDER BY
      s.ts
  ) AS events,
  count(*) n
FROM
  sessions s
WHERE
  s.ts > dateadd(day, -7, getdate())
GROUP BY
  s.user_id
HAVING
  count(*) > 3
ORDER BY
  n DESC
LIMIT
  500;

Why format Redshift?

Amazon Redshift shares Postgres roots but adds its own functions — LISTAGG … WITHIN GROUP, DATEADD/DATEDIFF, GETDATE() and distribution-aware SQL. The formatter parses Redshift grammar so LISTAGG ordering and date arithmetic format cleanly rather than breaking.

Ideal for the wide analytical queries that come out of the Redshift query editor or a BI tool, where aggregation over event data arrives as one long line.

All SQL formatters & beautifiers

Format PostgreSQLBeautify PostgreSQL
Format MySQLBeautify MySQL
Format T-SQLBeautify T-SQL
Format SQLiteBeautify SQLite
Format BigQueryBeautify BigQuery
Format OracleBeautify Oracle
Format SnowflakeBeautify Snowflake
Format RedshiftBeautify Redshift