mysql - how to delete taggregate_temp_ tables at once?

07
2014-07
  • tahafahed


    In my SQL I have multi tables like:


    taggregate_temp_1364792160
    taggregate_temp_1364795760
    taggregate_temp_1364799360
    taggregate_temp_1364802960
    taggregate_temp_1364806560
    taggregate_temp_1364810160
    taggregate_temp_1364813760
    taggregate_temp_1364817360
    taggregate_temp_1364820960
    taggregate_temp_1364824560
    taggregate_temp_1364828160
    taggregate_temp_1364831760
    taggregate_temp_1364835360
    taggregate_temp_1364838960
    taggregate_temp_1364842560
    taggregate_temp_1364846160
    taggregate_temp_1364849760
    taggregate_temp_1364853360

    I need to delete all tables begin with: taggregate_temp_ at once
    Can you help me please
    Sincerely,

  • Answers
  • RolandoMySQLDBA

    If all the temp tables are in mydb, run the following:

    SELECT CONCAT('DROP TABLE ',
    GROUP_CONCAT(CONCAT(table_schema,'.',table_name)),';')
    FROM information_schema.tables WHERE table_schema='mydb'
    AND table_name like 'taggregate_temp%';
    PREPARE s1 FROM @dropcmd; EXECUTE s1; DEALLOCATE PREPARE s1;
    

    I have done the same technique in another post of mine in the DBA StackExchange. That post also has a demonstration of the code's execution.

    Give it a Try !!!


  • Related Question

    internet explorer - How to delete all RSS feeds in IE at once?
  • Questioner

    I'm using Windows 7, IE8. Over the time, I've added many RSS feeds to IE. I now want to delete all of them at once and start over.

    Is there a quick and easy way to accomplish that? I hate having to delete one feed at a time through the UI, especially when I have hundreds of feeds.

    Thanks in advance for your help.


  • Related Answers
  • harrymc

    In IE7 & IE8, just delete the contents of :

    %LOCALAPPDATA%\Microsoft\Feeds
    

    which is normally the same as :

    C:\Users\<user-name>\AppData\Local\Microsoft\Feeds