
- 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
Can we perform MySQL UPDATE and change nothing in a table?
Yes, we can do that. Let us first create a table −
mysql> create table DemoTable( Id int ); Query OK, 0 rows affected (1.02 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(201); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable values(202); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values(290); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(301); Query OK, 1 row affected (0.13 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+------+ | Id | +------+ | 201 | | 202 | | 290 | | 301 | +------+ 4 rows in set (0.00 sec)
Following is the query to perform MySQL UPDATE without changing anything −
mysql> update DemoTable set Id=Id where Id=290; Query OK, 0 rows affected (0.08 sec) Rows matched: 1 Changed: 0 Warnings: 0
Let us check table records once again −
mysql> select *from DemoTable;
This will produce the following output. It displays the same result −
+------+ | Id | +------+ | 201 | | 202 | | 290 | | 301 | +------+ 4 rows in set (0.00 sec)
- Related Articles
- How can we update values in a MySQL table?
- How can we update any value in MySQL view as we can update the values in MySQL table?
- How can we change the name of a MySQL table?
- How can we change MySQL user password by using UPDATE statement?
- How can we update the values in one MySQL table by using the values of another MySQL table?
- Perform MySQL update with AND operator
- How can we use the output of LTRIM() and RTRIM() functions to update MySQL table?
- Can we update MySQL with if condition?
- How can we change the data type of the column in 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 we use MySQL TRIM() to remove the whitespaces from all the rows and update table?
- How to perform Increment in MySQL Update?
- Update table and order dates in MySQL
- Can we give underscore in a MySQL table name?

Advertisements