Repository: trafodion Updated Branches: refs/heads/master 82bfb1a22 -> 54d7e66b9
[TRAFODION-3114] Add *Syntax Descriptions and Examples* for *GET Statement* in *Trafodion SQL Reference Manual* Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/aa4e6262 Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/aa4e6262 Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/aa4e6262 Branch: refs/heads/master Commit: aa4e62620993673e8646e44a572c08ddded674c0 Parents: 07e94f3 Author: liu.yu <[email protected]> Authored: Tue Jun 19 19:44:01 2018 +0800 Committer: liu.yu <[email protected]> Committed: Tue Jun 19 19:44:01 2018 +0800 ---------------------------------------------------------------------- .../src/asciidoc/_chapters/sql_statements.adoc | 143 ++++++++++++++++++- 1 file changed, 141 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/aa4e6262/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc ---------------------------------------------------------------------- diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc index 8f7e6f0..51439af 100644 --- a/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc +++ b/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc @@ -5228,21 +5228,36 @@ GET is a {project-name} SQL extension. GET option option is: - COMPONENT PRIVILEGES ON component-name [FOR auth-name] + CATALOGS + | COMPONENT PRIVILEGES ON component-name [FOR auth-name] | COMPONENTS | FUNCTIONS FOR LIBRARY [[catalog-name.]schema-name.]library-name | FUNCTIONS [IN SCHEMA [catalog-name.]schema-name] + | HBASE REGISTERED TABLES IN CATALOG TRAFODION + | HIVE EXTERNAL TABLES IN CATALOG TRAFODION + | HIVE REGISTERED {OBJECTS | SCHEMAS | TABLES | VIEWS} IN CATALOG TRAFODION + | INDEXES [IN SCHEMA schema-name] + | INDEXES [ON TABLE table-name] | LIBRARIES [IN SCHEMA [catalog-name.]schema-name] | PROCEDURES FOR LIBRARY [[catalog-name.]schema-name.]library-name | PROCEDURES [IN SCHEMA [catalog-name.]schema-name] | ROLES [FOR USER database-username] + | SEQUENCES [IN {CATALOG catalog-name | SCHEMA schema-name}] | SCHEMAS [IN CATALOG catalog-name] | SCHEMAS FOR [USER | ROLE] authorization-id + | TABLES [IN CATALOG catalog-name] | TABLES [IN SCHEMA [catalog-name.]schema-name] + | TABLES [IN VIEW view-name] | USERS [FOR ROLE role-name] + | VIEWS [IN CATALOG catalog-name] | VIEWS [IN SCHEMA [catalog-name.]schema-name] + | VIEWS [IN VIEW view-name] + | VIEWS [ON VIEW view-name] | VIEWS ON TABLE [[catalog-name.]schema-name.]table-name | PRIVILEGES FOR {USER database-username | ROLE role-name} + | PRIVILEGES ON SEQUENCE sequence-name + | PRIVILEGES ON TABLE table-name + | PRIVILEGES ON VIEW view-name ``` [[get_syntax]] @@ -5332,6 +5347,10 @@ and the schema is seabase. + displays the names of all the tables in the specified schema. +* `TABLES [IN VIEW view-name]` ++ +returns tables that referenced by the view _view-name_. + * `users` + displays a list of all the registered database users. @@ -5351,9 +5370,19 @@ and the schema is seabase. + displays the names of all the views in the specified schema. For the _catalog-name_, you can specify only trafodion. +* `VIEWS [IN VIEW _view-name_]` ++ +returns views that referenced by the view _view-name_. + +* `VIEWS [ON VIEW _view-name_]` ++ +returns views that reference the view _view-name_. + * `views on table \[[_catalog-name_.]_schema-name_.]_table-name_` + -displays the names of all the views that were created for the specified table. If you do not qualify the table name with +returns views that reference the table _table-name_. ++ +If you do not qualify the table name with catalog and schema names, get uses the catalog and schema of the current session. For the _catalog-name_, you can specify only trafodion. @@ -5429,6 +5458,116 @@ GET VIEWS IN SCHEMA SEABASE2; GET VIEWS ON TABLE T; ``` +* This example makes comparisons among `GET VIEWS [IN VIEW _view-name_]`, `GET VIEWS [ON VIEW _view-name_]`, `GET VIEWS [ON TABLE _table-name_]` +and `GET TABLES [IN VIEW _view-name_]`. ++ +Creates the table _t1_. + ++ +``` +SQL>CREATE TABLE t1 (c1 int); + +--- SQL operation complete. +``` + ++ +Creates the view _v1_ based on the table _t1_. + ++ +``` +SQL>CREATE VIEW v1 AS SELECT * FROM t1; + +--- SQL operation complete. +``` + ++ +Creates the view _v2_ based on the view _v1_. + ++ +``` +SQL>CREATE VIEW v2 AS SELECT * FROM v1; + +--- SQL operation complete. +``` + ++ +This statement returns nothing as no views are referenced by _v1_. + ++ +``` +SQL>GET VIEWS IN VIEW v1; + +--- SQL operation complete. +``` + ++ +This statement returns _v1_ as _v1_ is referenced by _v2_. + ++ +``` +SQL>GET VIEWS IN VIEW v2; + +TRAFODION.SEABASE.V1 + +--- SQL operation complete. +``` + ++ +This statement returns _v2_ as _v2_ references _v1_. + ++ +``` +SQL>GET VIEWS ON VIEW v1; + +TRAFODION.SEABASE.V2 + +--- SQL operation complete. +``` + ++ +This statement returns nothing as no views reference _v2_. + ++ +``` +SQL>GET VIEWS ON VIEW v2; + +--- SQL operation complete. +``` + ++ +This statements returns _v1_ as _v1_ references _t1_. + ++ +``` +SQL>GET VIEWS ON TABLE t1; + +TRAFODION.SEABASE.V1 + +--- SQL operation complete. +``` + ++ +This statement returns _t1_ as _t1_ is referenced by _v1_. + ++ +``` +SQL>GET TABLES IN VIEW v1; + +TRAFODION.SEABASE.T1 + +--- SQL operation complete. +``` + ++ +This statement returns nothing as no tables are referenced by _v2_. + ++ +``` +SQL>GET TABLES IN VIEW v2; + +--- SQL operation complete. +``` + * This GET statement displays the names of the libraries in the catalog and schema of the current session, which happens to be TRAFODION.SEABASE: +
