How do I check if a created database has any tables added to it yet? I'm not looking for values inside a table but just tables in general.
Is there an equivalent to 'SELECT 1 FROM db_table' kind of query or is there a php function that can check if any tables exist in a database?
What I want to achieve is something along the lines of:
if(db_doesn't_have_tables) { show message }
else { do something }
CodePudding user response:
I hope this helps you :
SHOW TABLES FROM database
CodePudding user response:
Most databases support the INFORMATION_SCHEMA
catalog views:
select *
from INFORMATION_SCHEMA.TABLES
where TABLE_TYPE='BASE TABLE'
However all platforms will have better vendor-specific system tables for the purpose.