Related Documentation Download this Manual
PDF (US Ltr) - 43.3Mb
PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.1Kb
Man Pages (Zip) - 402.3Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.1Kb
Man Pages (Zip) - 402.3Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
MySQL Backup and Recovery
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
Security in MySQL
Starting and Stopping MySQL
MySQL and Linux/Unix
MySQL and Windows
MySQL and macOS
MySQL and Solaris
Building MySQL from Source
MySQL Restrictions and Limitations
MySQL Partitioning
MySQL Tutorial
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL NDB Cluster 8.0
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
Security in MySQL
Starting and Stopping MySQL
MySQL and Linux/Unix
MySQL and Windows
MySQL and macOS
MySQL and Solaris
Building MySQL from Source
MySQL Restrictions and Limitations
MySQL Partitioning
MySQL Tutorial
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL NDB Cluster 8.0
MySQL 8.0 Reference Manual / ... / Using MySQL as a Document Store / JavaScript Quick-Start Guide: MySQL Shell for Document Store / Relational Tables / Update Tables
You can use theupdate() method to modify one or more records in a table. Theupdate() method works by filtering a query to include only the records to be updated and then applying the operations you specify to those records.
To replace a city name in the city table, pass to theset() method the new city name. Then, pass to thewhere() method the city name to locate and replace. The following example replaces the city Peking with Beijing.
mysql-js> db.city.update().set("Name", "Beijing").where("Name = 'Peking'") Use theselect() method to verify the change.
mysql-js> db.city.select(["ID", "Name", "CountryCode", "District", "Info"]).where("Name = 'Beijing'")+------+-----------+-------------+----------+-----------------------------+| ID | Name | CountryCode | District | Info |+------+-----------+-------------+----------+-----------------------------+| 1891 | Beijing | CHN | Peking | {"Population": 7472000} |+------+-----------+-------------+----------+-----------------------------+1 row in set (0.00 sec)SeeTableUpdateFunction for the full syntax definition.
Related Documentation Download this ManualExcerpts from this Manual
PDF (US Ltr) - 43.3Mb
PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.1Kb
Man Pages (Zip) - 402.3Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.1Kb
Man Pages (Zip) - 402.3Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
MySQL Backup and Recovery
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
Security in MySQL
Starting and Stopping MySQL
MySQL and Linux/Unix
MySQL and Windows
MySQL and macOS
MySQL and Solaris
Building MySQL from Source
MySQL Restrictions and Limitations
MySQL Partitioning
MySQL Tutorial
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL NDB Cluster 8.0
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
Security in MySQL
Starting and Stopping MySQL
MySQL and Linux/Unix
MySQL and Windows
MySQL and macOS
MySQL and Solaris
Building MySQL from Source
MySQL Restrictions and Limitations
MySQL Partitioning
MySQL Tutorial
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL NDB Cluster 8.0