

- 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
MySQL query to update a specific cell to be empty
Let us first create a table −
mysql> create table DemoTable ( Id int, Name varchar(50) ); Query OK, 0 rows affected (0.47 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(1001,'Robert'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(1002,'Sam'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(1003,'Tom'); Query OK, 1 row affected (0.10 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+------+--------+ | Id | Name | +------+--------+ | 1001 | Robert | | 1002 | Sam | | 1003 | Tom | +------+--------+ 3 rows in set (0.00 sec)
Following is the query to update a specific cell to be empty in MySQL −
mysql> update DemoTable set Name='' where Id=1003; Query OK, 1 row affected (0.16 sec) Rows matched: 1 Changed: 1 Warnings: 0
Let us check the table records once again −
mysql> select *from DemoTable;
This will produce the following output −
+------+--------+ | Id | Name | +------+--------+ | 1001 | Robert | | 1002 | Sam | | 1003 | | +------+--------+ 3 rows in set (0.00 sec)
- Related Questions & Answers
- Update the content of a specific cell in MySQL
- MongoDB query to update a specific document from a collection
- MySQL update query to remove spaces?
- How to update empty string to NULL in MySQL?
- How to run MongoDB query to update only a specific field value?
- MongoDB query to update all documents matching specific IDs
- MySQL query to convert empty values to NULL?
- Get specific value of cell in MySQL
- A single MySQL query to update only specific records in a range without updating the entire column
- How to check if a specific country code exists in a cell with MySQL?
- MySQL query to split a column after specific characters?
- MySQL query to count rows with a specific column?
- How to find specific row with a MySQL query?
- MySQL query to get a specific row from rows
- How to bulk update MySQL data with a single query?
Advertisements