SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with removing entries from a phpMYadmin table

    How do I delete all the entries in a phpmyadmin table without deleting each one manually?
    Is there a way to delete a large amount of entries (but not all) from a phpmyadmin table without doing it manually?
    thanks

  2. #2
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,014
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    To delete all entries in a table you can use the "Empty" button. To delete certain records only use a DELETE query, build the DELETE query as a SELECT query first to make sure that you'll only be deleting what you expect to be deleted. Once you've triple checked and check again that only what you expected to be deleted has been selected, convert the SELECT query to a DELETE query
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,247
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    use this, it's easier --
    Code:
    TRUNCATE TABLE mytable
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your replies.
    Truncate table my table is used for which scenario?
    There's a table where I just want to keep the admin entry and remove all the rest. Is there any easy way to do that?

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,247
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by ChrisjChrisj View Post
    Truncate table my table is used for which scenario?
    the scenario you described in your original post -- "delete all the entries in a phpmyadmin table without deleting each one manually"


    Quote Originally Posted by ChrisjChrisj View Post
    There's a table where I just want to keep the admin entry and remove all the rest. Is there any easy way to do that?
    use DELETE with a WHERE clause
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    SitePoint Addict
    Join Date
    Jul 2006
    Location
    Fionnphort, Isle of Mull, Scotland
    Posts
    349
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Nobody seems to have mentioned that in a phpMyAdmin table, if you go to 'Browse' and scroll to the bottom you can click 'Check All' to select all the records, and then click 'Delete' (also at the bottom). If you want to keep some individual records, uncheck them (on the left of each record) before deleting.
    And make a copy of the table first, just in case.
    Tim Dawson
    Isle of Mull, Scotland

  7. #7
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and of course the important thing... There is no such thing as a phpmyadmin table. The table exists in the database, of which phpmyadmin is ONE of numerous tools to interface with the databases.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •