Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 12th, 2004, 10:10 AM
Registered User
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to macromotion Send a message via MSN to macromotion
Default Deleting all in mysql

Hi people, how do i do to delete all data in one table in mysql? i searched in my books, but don't found one results.


Tanks.

 
Old December 12th, 2004, 11:00 PM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 117
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Hi macromotion
use this syntax to delete all data from mysql table:

DELETE from table_name [WHERE conditions];

If you don't specify any conditions ALL THE DATA IN THE TABLE WILL BE DELETED

if you want to delete only some rows, you can user for example:

DELETE from employee_data
WHERE emp_id = 10;

Query OK, 1 row affected (0.00 sec)


Thanks
Regards
Mani_he


 
Old December 13th, 2004, 01:21 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

TRUNCATE TABLE `table_name`

hth,

-Snib - http://www.snibworks.com
Where will you be in 100 years?
 
Old December 15th, 2004, 04:59 PM
Registered User
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to macromotion Send a message via MSN to macromotion
Default

Tanks boys.

 
Old December 16th, 2004, 05:31 AM
Authorized User
 
Join Date: Oct 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to SiliconFuRy
Default

Where? Send in the mortar troops, Alpha-2-7-4! It's an invasion! ... oh wait....

*crawls back into hole*





Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting a row in MySQL database mattw1100 Beginning PHP 3 August 21st, 2008 05:28 PM
Deleting problems jackiew General .NET 0 August 17th, 2006 01:41 PM
deleting in datagrid derekl ASP.NET 1.0 and 1.1 Professional 2 January 26th, 2006 05:21 AM
deleting a datarow sand133 VB Databases Basics 0 July 14th, 2004 07:08 AM
Deleting Duplicates ioates SQL Server 2000 5 August 31st, 2003 10:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.