How To Update Values in a Table

Q

How To Update Values in a Table? - MySQL FAQs - Understanding SQL INSERT, UPDATE and DELETE Statements

✍: FYIcenter.com

A

If you want to update some values in one row or multiple rows in a table, you can use the UPDATE statement. The tutorial script below shows a good example:

mysql> UPDATE fyi_links SET counts = 999, notes = 'Good.' 
   WHERE id = 101;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT id, url, notes, counts, DATE(created) 
   FROM fyi_links WHERE id = 101;
+-----+-------------------+-------+--------+---------------+
| id  | url               | notes | counts | DATE(created) |
+-----+-------------------+-------+--------+---------------+
| 101 | dev.fyicenter.com | Good. |    999 | 2006-04-30    |
+-----+-------------------+-------+--------+---------------+
1 row in set (0.00 sec)

2007-05-11, 4717👍, 0💬