- I know that a MySQL view can be insertable/updatable link
- I also know that you can perform a merge/upsert in MySQL via the insert on duplicate syntax link
BUT my question is: Can you perform an upsert/merge (insert on duplicate) on a view in MySQL?
I doubt you could upsert/merge into a view because its precisely that just a view in memory of a specific set of data which could span multiple tables.
In MySQL, views are not only query-able but also updatable. It means that you can use the INSERT or UPDATE statement to insert or update rows of the underlying table through the updatable view. However, to create an updatable view, the SELECT statement that defines the view must not contain any of the following elements:
Aggregate functions such as MIN, MAX, SUM, AVG, COUNT, etc. DISTINCT GROUP BY clause Read more