Page 1 of 1

delete some field in database

Posted: Fri Jan 02, 2004 7:48 pm
by Vietboy
how would you delete some entries inside the mySQL database without dropping it?

Posted: Fri Jan 02, 2004 9:31 pm
by nigma
You want to delete a column? or give a cell a certain value (i.e. "". NULL)?

Posted: Sat Jan 03, 2004 1:10 am
by devork
are you talking about deleting certain records in database table?

Posted: Sat Jan 03, 2004 1:42 am
by infolock
if you want to delete an entry, you should just use DELETE query.

Refer to your manual for more indepth documentation that was included in your mysql distribution, or refer to mysql's site.

here's an example though :

Code: Select all

mysql_query("DELETE from loginfo where user = 'bob'");
if you are wanting to just drop a field from the table, use this :

Code: Select all

mysql_query("ALTER TABLE `mytable` DROP `my_column_name_to_drop'");

Posted: Sat Jan 03, 2004 8:29 am
by JAM
If wanted to clean out the entire table-data, but leaving the layout as is:

Code: Select all

TRUNCATE TABLE;