Tuesday, August 13, 2013
6:30 PM

How to clear all data in a column in a MySQL database table

In certain cases its essential to clear all data in a particular column in a table.
For example a database name is school
There is a table inside school is student
A column inside school is email 

Column email contains email ids of about 100 students.
Apply following command, if you want to clean all email id entries from email column.

mysql -uroot -p  [enter mysql root password]

You can get mysql command prompt, enter following commands there;

use school;
UPDATE `student` SET `email` = '';
quit;



Now email column inside student table is clean.

0 comments:

Post a Comment