SQL UPSERT Builder

Build INSERT ... ON CONFLICT / ON DUPLICATE KEY SQL from line-based column input and output bind values together.

Status

Runs in your browser. No input is sent to a server.

How to use

Fill table/rows, choose dialect and conflict action, then Build. Copy SQL and bind params into your implementation.

Notes (this tool)

  • PostgreSQL/SQLite require conflict keys for DO UPDATE/DO NOTHING.
  • Choose identifier quoting according to your SQL dialect.

About this page

What does this tool do?

Generates UPSERT SQL from `column|value` rows while handling syntax differences across MySQL/PostgreSQL/SQLite.

Supports update-column selection, conflict-key targets, and `DO NOTHING` mode for practical query drafting.

Notes

  • This tool does not execute SQL. Validate behavior in your DB/driver runtime.
  • PostgreSQL/SQLite UPSERT requires conflict keys (ON CONFLICT target).
  • Output is placeholder-based. Avoid executing concatenated raw values.

FAQ

Which columns should be updated in UPSERT?

Usually exclude primary/unique key columns and explicitly include only business fields intended for updates.

When should I use DO NOTHING vs UPDATE?

Use DO NOTHING when keeping existing rows on conflict; use UPDATE when applying incoming values.

Referenced specs

  • PostgreSQL INSERT ... ON CONFLICT
  • MySQL INSERT ... ON DUPLICATE KEY UPDATE
  • SQLite UPSERT

These links are generated from site_map rules in recommended diagnostic order.

  1. SQL WHERE Builder — Build WHERE clauses and bind params from condition rows
  2. Regex Tester — Test regex matching, extraction, and replacement
  3. Text Counter — Count characters including newline and full/half-width views
  4. .env Diff Checker — Compare .env added/removed/changed keys
  5. Regex Cheat Generator — Generate regex patterns from practical templates
  6. Mahjong Point Calculator — Calculate point movement on win from han/fu, honba, and kyotaku
  7. Mahjong All-Last Calculator — Compute ron/tsumo conditions needed to reach target rank from current scores
  8. Unix Time Converter — Convert Unix seconds/milliseconds and date-time both ways

Quick Calculators

One-screen calculators for commonly forgotten quick math