How to update data in MySQL table
Submitted by Richard on Tue, 07/20/2010 - 17:28
To do it, type this command:
Here's how to update existing data into MySQL database table.
update table set column='new_value' where where_condition;
The update statement updates columns of existing rows in the table with new values.
The table is the table name.
The set clause indicates which column to modify and the values they should be given.
The where clause specifies the conditions that identify which rows to update. Its very useful if you want to update selected rows in a table.
Example:
You want to change the password of "user" from "password" to "123".
- +----+----------+--------------------+----+----------+
- | id | username | attribute | op | value |
- +----+----------+--------------------+----+----------+
- | 1 | user | Cleartext-Password | := | password |
- +----+----------+--------------------+----+----------+
To do it, type this command:
update radcheck set value='123' where id=1;
Check your
select * from radcheck;
Check the changes
- +----+----------+--------------------+----+-------+
- | id | username | attribute | op | value |
- +----+----------+--------------------+----+-------+
- | 1 | user | Cleartext-Password | := | 123 |
- +----+----------+--------------------+----+-------+
- 1 row in set (0.00 sec)
Bookmark/Search this post with:

Delicious
Digg
StumbleUpon
Furl
Facebook
MySpace
Twitter
Google
Yahoo
Buzz Up!
LinkedIn
Technorati



Comments
Post new comment