
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we update values in a MySQL table?
With the help of UPDATE statement and WHERE clause, we can update the values in single or multiple rows of the table. MySQL updates the values on the basis of condition specified in WHERE clause. For example, suppose in the ‘employee’ table we want to change the ‘name’ and ‘doj’ of the employee whose id is 1 then it can be done with the following query −
mysql> UPDATE employee SET name = 'Gaurav', doj = '2010-02-01' WHERE id = 1; Query OK, 1 row affected (0.06 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from employee WHERE id = 1; +------+--------+------------+ | id | name | doj | +------+--------+------------+ | 1 | Gaurav | 2010-02-01 | +------+--------+------------+ 1 row in set (0.00 sec)
- Related Articles
- How can we update any value in MySQL view as we can update the values in MySQL table?
- How can we update the values in one MySQL table by using the values of another MySQL table?
- How can we update MySQL table after removing a particular string from the values of column?
- How can we update MySQL table after padding a string with the values of the column?
- How can you update certain values in a table in MySQL using Python?
- Can we perform MySQL UPDATE and change nothing in a table?
- How can we update columns values on multiple rows with a single MySQL UPDATE statement?
- How can I create a stored procedure to update values in a MySQL table?
- How can we add values into the columns of a MySQL table?
- Can we insert records in a MySQL table without auto_increment values?
- How can we count a number of unique values in a column in MySQL table?
- How to update a MySQL table by swapping two column values?
- How can I update the boolean values in MySQL?
- Update multiple values in a table with MySQL IF Statement
- How can I update MySQL table after quoting the values of a column with a single quote?

Advertisements