Note
This view is available starting with V4.0.0.
Purpose
This view displays information about tables and views used in view definitions.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| VIEW_CATALOG | varchar(64) | NO | The name of the catalog to which the view belongs. |
| VIEW_SCHEMA | varchar(128) | NO | The name of the schema to which the view belongs. |
| VIEW_NAME | varchar(256) | NO | The name of the view. |
| TABLE_SCHEMA | varchar(128) | NO | The name of the schema to which the table or view used in the view definition belongs. |
| TABLE_NAME | varchar(256) | NO | The name of the table or view used in the view definition. |
| TABLE_CATALOG | varchar(64) | NO | The name of the catalog to which the table or view used in the view definition belongs. This value is always def. |
Sample query
Query the information about tables and views used in the view1 view.
obclient [infotest]> SELECT * FROM information_schema.VIEW_TABLE_USAGE WHERE VIEW_NAME='view1';
The query result is as follows:
+--------------+-------------+-----------+--------------+------------+---------------+
| VIEW_CATALOG | VIEW_SCHEMA | VIEW_NAME | TABLE_SCHEMA | TABLE_NAME | TABLE_CATALOG |
+--------------+-------------+-----------+--------------+------------+---------------+
| def | infotest | view1 | infotest | tbl1 | def |
+--------------+-------------+-----------+--------------+------------+---------------+
1 row in set