Home > Database > Mysql Tutorial > How can we view the list of views stored in a specific MySQL database?

How can we view the list of views stored in a specific MySQL database?

王林
Release: 2023-09-01 22:29:02
forward
1062 people have browsed it

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

#With the help of the following query, we can view the list of views stored in a specific database. We are using a database called "query" here.

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)
Copy after login

The above is the detailed content of How can we view the list of views stored in a specific MySQL database?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template