How to Update Data in MySQL

Last Updated on: January 27, 2011

Once you’ve inserted data into your MySQL tables, you’re going to have to change it at one point.

The type of query that you use to update data is called an UPDATE query. It is used to change the values in rows that already exist. The syntax for the query is as follows:

{code type=sql}UPDATE table_name SET table_column = value, … WHERE table_column = value{/code}

Again, the first parameter table_name is fairly self-explanatory. The next two sections behave a little bit like an INSERT query in that the values that you are using have to be properly quoted in order for the query to run. The first of these is all of the data that you are updating in the MySQL database. The second is the parameters that tell the query where to update the values. This is optional. Without it, the query will set the values for every row in the table.

That’s pretty much all that you need to know about MySQL query updates. If you have any questions, please leave a comment!

Similar Posts

Leave a Reply

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