SaveSnippets
Community
Pricing
Sign In
Get Started
Community
Public Snippets
1
Code shared by the SaveSnippets community — browse, copy, and get inspired.
All Languages
Bash
Go
HTML
Java
JavaScript
Kotlin
PHP
Python
Rust
SQL
TypeScript
#on-duplicate-key
Clear
Tags
#php
#kotlin
#bash
#go
#sql
#rust
#typescript
#html
#java
#python
#files
#utils
#strings
#http
#concurrency
#async
#json
#arrays
#security
#types
#crypto
#database
#dates
#format
SQL
UPSERT — MySQL ON DUPLICATE KEY UPDATE
MySQL's flavor of upsert. Triggers when an INSERT would violate a PRIMARY KEY or UNIQUE constraint. Use `VALUES()` (or `NEW.col` in MySQL 8.0.20+) to reference the would-be-inserted row.
#sql
#mysql
#upsert
#on-duplicate-key