

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- 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?
- 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 update the values in one MySQL table by using the values of another MySQL table?
- How can we change the data type of the column in MySQL table?
- Update table and order dates in MySQL
- How can we make a MySQL clone table?
- Can we use {} while creating a MySQL table?
- Can we give underscore in a MySQL table name?
- Update a MySQL table with Java MySQL
- Can we use ADD and CHANGE with ALTER Statement in MySQL?
Advertisements