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
Next to view (diagnostic order)
These links are generated from site_map rules in recommended diagnostic order.
- SQL WHERE Builder — Build WHERE clauses and bind params from condition rows
- Regex Tester — Test regex matching, extraction, and replacement
- Text Counter — Count characters including newline and full/half-width views
- .env Diff Checker — Compare .env added/removed/changed keys
- Regex Cheat Generator — Generate regex patterns from practical templates
- Mahjong Point Calculator — Calculate point movement on win from han/fu, honba, and kyotaku
- Mahjong All-Last Calculator — Compute ron/tsumo conditions needed to reach target rank from current scores
- Unix Time Converter — Convert Unix seconds/milliseconds and date-time both ways
Same-theme links
Quick Calculators
One-screen calculators for commonly forgotten quick math
- Mahjong Point Calculator — Calculate point movement on win from han/fu, honba, and kyotaku
- Mahjong All-Last Calculator — Compute ron/tsumo conditions needed to reach target rank from current scores
- Unix Time Converter — Convert Unix seconds/milliseconds and date-time both ways
- Cron Builder — Build 5-field cron and preview upcoming runs
- Text Counter — Count characters including newline and full/half-width views
- Regex Tester — Test regex matching, extraction, and replacement
- Regex Cheat Generator — Generate regex patterns from practical templates
- SQL WHERE Builder — Build WHERE clauses and bind params from condition rows
- Random Token Generator — Generate random tokens with selectable byte size and encoding