Deleting all records from a table in PHPMyadmin

Posted on 2009-07-12
Last Modified: 2012-05-07
Seeking step-by-step instructions to delete all records in a table called MyTable.  Thanks!
Question by:BBRRGG
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 75

Accepted Solution

Aneesh Retnakaran earned 200 total points
ID: 24837186
if there is no relations u just need to use


otherwise you need to delete the recods for the related table then delete from this table
delete from relatedTable where foreignKey in (select primaryKey from MyTable)
delete from MyTable

Assisted Solution

SadiDev earned 100 total points
ID: 24837900
There is two query to do this job:
1) DELETE FROM table_name
2) TRUNCATE TABLE table_name

First one only delete the records, you can use it with WHERE clause too.
The second one will delete all the records and reset the auto id/number fields.

There is a tab named (labeled) 'Empty' in MyPHPAdmin. It will do the same task as TRUNCATE TABLE command.

Thank you

Expert Comment

ID: 24837913
Oh! One more thing about DELETE and TRUNCATE TABLE :
DELETE command delete the records individually; but TRUNCATE TABLE command erase all the records at once.

Thank you
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

LVL 13

Assisted Solution

by:Philip Pinnell
Philip Pinnell earned 50 total points
ID: 24839212
In phpMyAdmin on the database view (list of tables) click the bin on the table you want to empty.

This runs the truncate table command as mentioned above. Also pay heed to the related records comment above too.
LVL 13

Expert Comment

by:Philip Pinnell
ID: 24839222
sorry sadi you already said that.

Author Closing Comment

ID: 31602705
LVL 13

Expert Comment

by:Philip Pinnell
ID: 24863343

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Passing client data from form to server 5 23
Convert VBA UDF to SQl SERVER UDF 4 51
Secure log in 'box' 4 14
SQL Server XML Select sub tables 4 30
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question