Overview
Displays information about the tables and views used in the view definition.
Columns
Field Name |
Type |
Whether can be NULL |
Description |
|---|---|---|---|
| VIEW_CATALOG | varchar(64) | NO | The name of the directory to which the view belongs. |
| VIEW_SCHEMA | varchar(128) | NO | SCHEMA name to which the view belongs |
| VIEW_NAME | varchar(256) | NO | View Name |
| 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 directory 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 v_test_tbl1 view.
obclient [infotest]> SELECT * FROM information_schema.VIEW_TABLE_USAGE WHERE VIEW_NAME='v_test_tbl1';
The query result is as follows:
+--------------+-------------+-------------+--------------+------------+---------------+
| VIEW_CATALOG | VIEW_SCHEMA | VIEW_NAME | TABLE_SCHEMA | TABLE_NAME | TABLE_CATALOG |
+--------------+-------------+-------------+--------------+------------+---------------+
| def | infotest | v_test_tbl1 | infotest | tbl6 | def |
+--------------+-------------+-------------+--------------+------------+---------------+
1 row in set