+ 1
How to check if table exist in mysql
How to check if table exits in mysql
6 Respostas
+ 8
+ 8
By using the command "SHOW TABLES" in the known database.
OR
SELECT *FROM Table2. (where Table2 is the table whose existence u want to check.)
OR
SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '[database name]' AND table_name = '[table name]';
+ 6
Shariff Wlcm.
+ 3
For show all tables ==> Show tables ;
Or
For search by name ==> show tables like 'yourTableName';
+ 1
Alphin K Sajan how will you execute this from PDO
SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '[database name]' AND table_name = '[table name]';
will this return Boolean ? and can we execute this query in PDO?
+ 1
Thanks, it was helpful , let me check it out