
- 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
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 Articles
- 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
- A single MySQL query to update only specific records in a range without updating the entire column
- MySQL query to convert empty values to NULL?
- MySQL update query to remove spaces between letters?
- MySQL query to update only month in date?
- How to bulk update MySQL data with a single query?
- MySQL query to update different fields based on a condition?
- MySQL query to count rows with a specific column?
- How to find specific row with a MySQL query?
- MySQL query to split a column after specific characters?

Advertisements