我正在寻找一种方法来列出数据库中的所有视图.
I'm looking for a way to list all views in a database.
最初我在 MySQL 论坛上找到并尝试了 答案:
Initially I found and tried an answer on the MySQL forums:
SELECT table_name
FROM information_schema.views
WHERE information_schema.views.table_schema LIKE 'view%';
无论如何这都不起作用,返回一个空集.(我知道他们在那里!)
How ever this doesn't work, returning an empty set. (I know they're in there!)
这些也失败了:
mysql> use information_schema;
Database changed
mysql> select * from views;
ERROR 1102 (42000): Incorrect database name 'mysql.bak'
mysql> select * from tables;
ERROR 1102 (42000): Incorrect database name 'mysql.bak'
为什么这不起作用?
SHOW FULL TABLES IN database_name WHERE TABLE_TYPE LIKE 'VIEW';
MySQL 查询以查找数据库中的所有视图
这篇关于如何获取 MySQL 视图列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!