Dialects / Updated May 23, 2026

PostgreSQL vs MySQL formatting notes

PostgreSQL and MySQL share a familiar SQL foundation, but production queries often contain dialect-specific syntax. A dialect-aware beautifier should preserve those details while making the query readable for humans.

Identifier quoting

PostgreSQL uses double quotes for quoted identifiers. MySQL commonly uses backticks. Formatting should not rewrite identifier quoting because that can affect case sensitivity and reserved word handling.

-- PostgreSQL
SELECT
  "user".id,
  "user".email
FROM "user";

-- MySQL
SELECT
  `user`.id,
  `user`.email
FROM `user`;

Pagination syntax

Both databases support LIMIT, but teams may use different ordering conventions. Keep ORDER BY close to LIMIT so reviewers can verify pagination determinism.

SELECT
  id,
  created_at
FROM invoices
WHERE account_id = 42
ORDER BY created_at DESC, id DESC
LIMIT 50;

Functions and date arithmetic

Date functions and interval syntax differ across databases. Choosing the correct dialect in SQL Script helps preserve the original syntax while still improving whitespace and indentation.

-- PostgreSQL
WHERE created_at >= CURRENT_DATE - INTERVAL '30 days'

-- MySQL
WHERE created_at >= DATE_SUB(CURRENT_DATE, INTERVAL 30 DAY)

CTEs and readability

PostgreSQL and modern MySQL versions support common table expressions. Use CTEs when they clarify a complex transformation, and format each CTE as a named block.

WITH paid_orders AS (
  SELECT
    customer_id,
    total_amount
  FROM orders
  WHERE status = 'paid'
)
SELECT
  customer_id,
  SUM(total_amount) AS paid_revenue
FROM paid_orders
GROUP BY customer_id;

Choose the matching dialect

If your query targets PostgreSQL, select PostgreSQL in the tool. If it targets MySQL, choose MySQL. The visual style may be similar, but dialect selection helps the beautifier and optimizer parse database-specific syntax.

Practical tip: standardize formatting by database family in your team docs, especially if your organization uses multiple relational databases.

Try it in SQL Script by switching between PostgreSQL and MySQL in the dialect selector.