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
Solved

Deleting all records from a table in PHPMyadmin

Posted on 2009-07-12
7
430 Views
Last Modified: 2012-05-07
Seeking step-by-step instructions to delete all records in a table called MyTable.  Thanks!
0
Comment
Question by:BBRRGG
7 Comments
 
LVL 75

Accepted Solution

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

TRUNCATE TABLE MyTable

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
0
 
LVL 2

Assisted Solution

by:SadiDev
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
Sadi
0
 
LVL 2

Expert Comment

by:SadiDev
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
Sadi
0
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
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.
0
 
LVL 13

Expert Comment

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

Author Closing Comment

by:BBRRGG
ID: 31602705
Thanks!
0
 
LVL 13

Expert Comment

by:Philip Pinnell
ID: 24863343
thanks
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

789 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