MySQL——Query whether the specified database and table exist
1. Check whether the specified database exists
SELECT information_schema.SCHEMATA.SCHEMA_NAME FROM information_schema.SCHEMATA where SCHEMA_NAME='databaseName';
2. Check whether the specified database exists Whether a certain table exists under the database
SELECT DISTINCT t.table_name, n.SCHEMA_NAME FROM information_schema.TABLES t, information_schema.SCHEMATA n WHERE t.table_name = 'tableName' AND n.SCHEMA_NAME = 'databaseName';
The above is the content of MySQL - query whether the specified database and table exist. For more related content, please pay attention to the PHP Chinese website ( m.sbmmt.com)!