BackendQuestion 48 of 52
Upsert (ON CONFLICT)
Problem
You are building a sync script that fetches user statistics. If a user already exists in the database, you want to update their stats; if not, you want to insert a new row. Write a query that outputs concept with the value: "UPSERT operations insert a row if it does not exist, or update it if a conflict occurs on a unique key."
Database Schema
This problem acts as a scratchpad. You will write your own DDL/DML or conceptual queries, so there is no predefined schema.
Try It
Loading playground environment...