If you need to update the value for a column in a MySQL or MariaDB table, two relational database management systems named after the daughters, My and Maria, of the lead developer for the projects, Michael Widenius, where there is a space in the column name, use the backtick , aka, bakckquote, character, i.e.,
`
, to enclose the name of
the column. E.g., to update an entry in a table named "Sales" in a
database named "packages", if the field was named "Work Phone", I could
use the following:
MariaDB [(none)]> use personnel; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [personnel]> UPDATE Sales SET `Work Phone` = '555.555.5555' WHERE LName = 'Smith'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [personnel]>
You can also use the command below to update the entry without first
selecting the database with the Use
command.
UPDATE `personnel.`Sales` SET `Work Phone` = '555.555.5555' WHERE `Sales`.`LName` = 'Smith';
References:
-
MySQL UPDATE QUERY
tutorialspoint - Simply easy learning