C# 检查是否存在多个mysql表

C# 检查是否存在多个mysql表,c#,mysql,mysql-connector,C#,Mysql,Mysql Connector,我想用Mysql检查一下,是否存在3个表,但不知何故,这不适用于多于1个表?如何检查是否存在3个表 Select count(*) From information_schema.tables where table_schema = 'userbook' and table_name = 'entry' and table_name = 'stats' and table_name = 'user'; 我正在使用MySQL Connector和Microsoft Visual

我想用Mysql检查一下,是否存在3个表,但不知何故,这不适用于多于1个表?如何检查是否存在3个表

Select count(*) From information_schema.tables
    where table_schema = 'userbook' and table_name = 'entry'
    and table_name = 'stats' and table_name = 'user';

我正在使用MySQL Connector和Microsoft Visual Studio 2012。

现在,您正在寻找一个表,该表的名称
条目
名称
统计数据
和名称
用户
-都同时存在。在这个问题上,你的计数永远是0

您需要像这样使用
运算符:

SELECT COUNT(*)
FROM information_schema.tables
WHERE
  table_schema = 'userbook' AND 
  (table_name = 'entry' OR
   table_name = 'stats' OR
   table_name = 'user')
您还可以在
中使用
,这更易于维护:

SELECT COUNT(*)
FROM information_schema.tables
WHERE
  table_schema = 'userbook' AND 
  table_name IN ('entry','stats','user')
在这两种情况下:如果计数为3,则所有三个表都存在