UPDATE 表名 SET 字段1 = 值1, 字段2 = 值2,... WHERE 条件;
Change the name corresponding to ID 12 to Laoha:
update users SET name = '老哈' where id = 12;##2. DeleteYou can delete one record or multiple records in the table through DELETE
DELETE FROM 表名 WHERE 条件;
Delete the data corresponding to id equal to 9:
DELETE FROM users WHERE id = 9;
Delete all data:
DELETE FROM 表名;
TRUNCATE delete:
TRUNCATE TABLE 表名;
The difference between DELETE and TRUNCATE:
Delete table:
DROP TABLE 表名1, 表名2, ...;
Delete database:
DROP DATABASE 数据库名字;
The above is the detailed content of How to update and delete in MySQL. For more information, please follow other related articles on the PHP Chinese website!