Checking if a row with the same element already exists

Hello, I am new to supabase and I struggle with update and insert(in a database). I need to be able to update a row if the row already exist and insert it if it doesn't exists. I tried using the command upsert but it didn't work. (I might have used it wrong but i couldn't find an exemple of it with 2 different confilcts) . So I using delete and insert but it didn't work either. Does anyone knows how I can make some kind of if to check if a row with the same 'user' and 'letter' has been already inserted into the database ?
Here's a screenshot of my database and code to make it a little bit more understandable :

(Sorry if my question is not well written I am not a native speaker.)
unknown.png
unknown.png
Was this page helpful?