UPDATE table using CTE
No magic. CTE in this case is an updatable view.

Updatable and Insertable Views:


SQL Server
Oracle
MySQL
DB2
Teradata



  The following statement seems to do exactly the same:


In general - no. Simply imagine that id is not unique.


  Is the first option better?


Two queries with different (general) logic cannot be compared. - akina