Tuesday, November 6, 2012

Create Query for all table in mysql


1. create query for change all tables to innodb ENGINE in mysql


SELECT CONCAT('ALTER TABLE ', table_name, ' ENGINE=InnoDB;') as ExecuteTheseSQLCommands
FROM information_schema.tables WHERE table_schema = 'database_name'
ORDER BY table_name DESC;

2. create query for  TRUNCATE TABLE  all database table


SELECT CONCAT('TRUNCATE TABLE ', table_name, ';')
FROM INFORMATION_SCHEMA.tables
WHERE table_schema = 'database_name'

1 comment:

  1. Hey!
    Thanks for your great post, there are much nice information that I am sure a huge number of guys and gals don’t know.


    Vachel
    PHP Developer Chicago
    cmscentral.net

    ReplyDelete

If you Satisfied , Please Leave a comment