SQL to check if database is empty (no tables)

前端 未结 11 1341
后悔当初
后悔当初 2021-02-14 04:59

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!

11条回答
  •  再見小時候
    2021-02-14 05:49

    select count(*)
      from information_schema.tables
     where table_type = 'BASE TABLE'
       and table_schema = 'your_database_name_here'
    

提交回复
热议问题