Hands-On GUI Programming with C++ and Qt5
上QQ阅读APP看书,第一时间看更新

UPDATE

The UPDATE statement modifies existing data in the database. You must specify a condition for the UPDATE command as otherwise, it will modify every single piece of data in a table, which is not our intended behavior. Try the following command, which will change the username and password of the first user:

UPDATE user SET username = "test1", password = "1234321" WHERE id = 1;

The command will fail, however, if the user with ID 1 does not exist. The command will also return the status 0 rows affected if the username and password data you provided matches exactly with the one stored in the database (nothing to change). For more information regarding the UPDATE statement, please refer to the following link:

 https://dev.mysql.com/doc/refman/5.7/en/update.html