How can I modify the information of a specific row in MySQL?

To modify the information of a specific row in a MySQL database, you can use the UPDATE statement. The specific syntax is as follows:

UPDATE 表名 SET 列名1=新值1, 列名2=新值2, ... WHERE 条件;

The table name is the name of the table where the data to be modified is located, the column name is the name of the column to be modified, the new value is the value that you want to change the column to, and the condition is the criteria used to select the rows to be modified.

For example, let’s say there is a table called students with columns id, name, and age. Now, if we want to change the name of the row with id 1 to “John” and the age to 18, we can use the following statement:

UPDATE students SET name='John', age=18 WHERE id=1;

After executing this statement, the name and age of the row with id 1 will be updated with new values.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds