UPSERT is UPDATE + INSERT. If the record we are trying to insert is already there in the table, it will UPDATE. If the record is not there, it will INSERT. This is used for cases where you're not sure whether a record will be updated or inserted. You can also update the table using the primary key values in the VALUES clause by using WITH PRIMARY KEY.
UPSERT course (id, name, price, instructor) VALUES ('C20', 'TEST', 1000, 5)
WHERE id = 'C20';
-- Update a record based on the primary key in the VALUES clause
UPSERT table1 VALUES (1, 'A') WITH PRIMARY KEY;