MySQL判断数据库和数据表是否存在

运行环境 : MySQL

1、判断 MySQL 中 , 数据库是否存在

SELECT * FROM information_schema.SCHEMATA where SCHEMA_NAME='skt100_200';  // 返回值为 0 或 1

2、判断 MySQL 中 , 数据表是否存在

SELECT table_name FROM information_schema.TABLES WHERE table_name ='card';  // 返回值为 0 或 1