首頁  >  文章  >  資料庫  >  我們如何查看儲存在特定 MySQL 資料庫中的視圖清單?

我們如何查看儲存在特定 MySQL 資料庫中的視圖清單?

王林
王林轉載
2023-09-01 22:29:02994瀏覽

我们如何查看存储在特定 MySQL 数据库中的视图列表?

借助以下查詢,我們可以查看儲存在特定資料庫中的視圖清單。我們在這裡使用名為“query”的資料庫。

mysql> SELECT TABLE_NAME FROM information_schema.`TABLES` WHERE TABLE_TYPE LIKE'view' AND TABLE_SCHEMA LIKE 'query';
+-----------------------------+
| TABLE_NAME                  |
+-----------------------------+
| customer_view               |
| first_view                  |
| info                        |
| info_less                   |
| view_detail                 |
| view_student_detail         |
| view_student_detail_columns |
+-----------------------------+
7 rows in set (0.01 sec)

mysql> SHOW FULL TABLES IN query WHERE TABLE_TYPE LIKE 'VIEW';
+-----------------------------+------------+
| Tables_in_query             | Table_type |
+-----------------------------+------------+
| customer_view               | VIEW       |
| first_view                  | VIEW       |
| info                        | VIEW       |
| info_less                   | VIEW       |
| view_detail                 | VIEW       |
| view_student_detail         | VIEW       |
| view_student_detail_columns | VIEW       |
+-----------------------------+------------+
7 rows in set (0.01 sec)

mysql> SELECT TABLE_SCHEMA, TABLE_NAME
    -> FROM information_schema.tables
    -> WHERE TABLE_TYPE LIKE 'VIEW'AND TABLE_SCHEMA = 'query';
+--------------+-----------------------------+
| TABLE_SCHEMA | TABLE_NAME                  |
+--------------+-----------------------------+
| query        | customer_view               |
| query        | first_view                  |
| query        | info                        |
| query        | info_less                   |
| query        | view_detail                 |
| query        | view_student_detail         |
| query        | view_student_detail_columns |
+--------------+-----------------------------+
7 rows in set (0.05 sec)

以上是我們如何查看儲存在特定 MySQL 資料庫中的視圖清單?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除