MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
September
Sun Mon Tue Wed Thu Fri Sat
    2
     
2015
Months
Sep


Wed, Sep 02, 2015 10:40 pm

Updating a MySQL table entry with a space in the table name

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:

  1. MySQL UPDATE QUERY
    tutorialspoint - Simply easy learning

[/software/database/mysql] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo