SQL UPDATE Statement

0
294

sqltuts

A user can do so by using SQL UPDATE Statement. This will help in modifying any field value of any MySQL table in a given database. There might be a situation when an existing data in a MySQL table needs to be modified.

 

The basic syntax which is used to update the given table

The WHERE clause is used when a user wants to update selected rows in the desired table.

Updating Data from Command Prompt:

This will use SQL UPDATE Statement with WHERE clause to update selected data into MySQL table tutorials_table.

 

Example:

This will update tutorial_name field for a record having tutorial_id as 15.

 

Updating Data Using PHP Script:

SQL UPDATE command can be used with or without WHERE CLAUSE into PHP function mysql_query().

 

This function will itself execute SQL command in the same way as it is executed at mysql> prompt.

Example:

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.