Deprecated: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/sqldump/public_html/config.php on line 184

Warning: mysql_query(): Access denied for user ''@'localhost' (using password: NO) in /home/sqldump/public_html/config.php on line 184

Warning: mysql_query(): A link to the server could not be established in /home/sqldump/public_html/config.php on line 184
SQL UPDATE tutorial and update database query examples

SQL statement: UPDATE

The general syntax of the SQL UPDATE command looks like this, using our Customers table example:

UPDATE Customers SET FirstName = 'Michael' WHERE FirstName = 'Mike'

All this command does is simply replace the name 'Mike' with 'Michael'. In our case, this will only change one row in the table. If we don't specify a WHERE clause in the query, then the query will update ALL rows. In our case, all customers will now have the first name 'Mike'.

Back to table of contents