I need to check if a database is totally empty (no tables) using an SQL query. How can this be done?
Thanks for the help!
SELECT COUNT(DISTINCT `table_name`) FROM `information_schema`.`columns` WHERE `table_schema` = 'your_db_name'
will return the actual number of tables (or views) in your DB. If that number is 0, then there are no tables.