Syntax\n------\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_reference \n  [PARTITION (partition_list)]\n  [FOR PORTION OF period FROM expr1 TO expr2]\n  SET col1={expr1|DEFAULT} [,col2={expr2|DEFAULT}] ...\n  [WHERE where_condition]\n  [ORDER BY ...]\n  [LIMIT row_count]\n  RETURNING OLD_VALUE(val) AS old [, val as new]\n\nDescription\n-----------\n\nFor the single-table syntax, the UPDATE statement updates columns of existing rows in the named table with new values. TheSET clause indicates which columns to modify and the values they should be given. Each value can be given as an expression, or the keywordDEFAULT to set a column explicitly to its default value. TheWHERE clause, if given, specifies the conditions that identify which rows to update. With no WHERE clause, all rows are updated. If the ORDER BY clause is specified, the rows are\\\nupdated in the order that is specified. The LIMIT clause places a limit on the number of rows that can be updated.\n\nBoth clauses can be used with multiple-table updates.\n\nBoth clauses can be used with multiple-table updates. For the multiple-table syntax, UPDATE updates rows in each table named in table_references that satisfy the conditions. In this case, ORDER BY and LIMIT could not be used.\n\nAn UPDATE can also reference tables which are located in different databases; see Identifier Qualifiers for the syntax.\n\nwhere_condition is an expression that evaluates to true for each row to be updated.\n\ntable_references and where_condition are as specified as described in SELECT.\n\nFor single-table updates, assignments are evaluated in left-to-right order, while for multi-table updates, there is no guarantee of a particular order. If the SIMULTANEOUS_ASSIGNMENT sql_mode is set, UPDATE statements evaluate all assignments simultaneously.\n\nYou need the UPDATE privilege only for columns referenced in an UPDATE that are actually updated. You need only the SELECT privilege for any columns that are read but not modified. See GRANT.\n\nThe UPDATE statement supports the following modifiers:\n\n If you use the LOW_PRIORITY keyword, execution of the UPDATE is delayed until no other clients are reading from the table. This affects only storage engines that use only table-level locking (MyISAM, MEMORY, MERGE). See HIGH_PRIORITY and LOW_PRIORITY clauses for details.\n If you use the IGNORE keyword, the update statement does not abort even if errors occur during the update. Rows for which duplicate-key conflicts occur are not updated. Rows for which columns are updated to values that would cause data conversion errors are updated to the closest valid values instead.\n\nPARTITION\n\nSee Partition Pruning and Selection for details.\n\nFOR PORTION OF\n\nSee Application Time Periods - Updating by Portion.\n\nUPDATE Statements With the Same Source and Target\n\nUPDATE statements may have the same source and target. For example, given the following table:\n\n``sql\nDROP TABLE t1;\nCREATE TABLE t1 (c1 INT, c2 INT);\nINSERT INTO t1 VALUES (10,10), (20,20);\n\nUPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);\n\nSELECT * FROM t1;\n+------+------+\n| c1   | c2   |\n+------+------+\n|   10 |   10 |\n|   21 |   20 |\n+------+------+\n``\n\nExamples\n--------\n\nUPDATE table_name SET column1 = value1, column2 = value2 WHERE id=100;\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/update