http://dev.mysql.com/doc/refman/5.1/en/tables-table.html
↑ここに書いてあるとおりですが、次のsqlで区別できます。
VIEWの場合
SELECT table_name, table_type FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'test_db' and table_name LIKE 'test_view'; +------------+------------+ | table_name | table_type | +------------+------------+ | test_view | VIEW | +------------+------------+ 1 row in set (0.00 sec)
TABLEの場合
SELECT table_name, table_type FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'test_db' and table_name LIKE 'test_table'; +------------+------------+ | table_name | table_type | +------------+------------+ | test_table | BASE TABLE | +------------+------------+ 1 row in set (0.00 sec)
単純にテーブルの存在を確認する場合
以下は、おまけです
show tables like '$table_name'