Documentation
Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

referenced_tables

referenced_tables counts the number of tables/views that are referenced by the query that match the entries present in the specified pinned table.

See also:
ALTER SUNDECK TABLE,

Syntax

  REFERENCED_TABLES(<pin table identifier>, <db column name>, <schema column name>, <table column name>)  <ComparisionOperator> <count>

Arguments

<pin table identifier>
Identifier of pin table.
<db column name>
Column name of database name in pin table.
<schema column name>
Column name of schema name in pin table.
<table column name>
Column name of table name in pin table.
<ComparisionOperator>
One of Snowflake comparision opearator ComparisionOperator.
<count>
Count to match against

Returns

TRUE
If count comparison is successful with number of tables/views that are referenced by the query that match the entries present in the specified pinned table.
FALSE
If count comparison is unsuccessful with number of tables/views that are referenced by the query that match the entries present in the specified pinned table.

Examples

Sf Pin Table: MYDB.PINTABLE.LARGE_TABLE_LIST

DB_NAMESCHEMA_NAMETABLE_NAME
SNOWFLAKE_SAMPLE_DATATPCH_SF1ORDERS
SNOWFLAKE_SAMPLE_DATATPCH_SF1LINEITEM
REFERENCED_TABLES(MYDB.PINTABLE.LARGE_TABLE_LIST, 'DB_NAME', 'SCHEMA_NAME', 'TABLE_NAME') > 1
sqlResultCOMMENT
select count(*) from SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.ORDERS,SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.LINEITEMTRUETwo different tables referred
select count(*) from SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.LINEITEM,SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.LINEITEMTRUETwo same tables referred
select count(*) from SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.LINEITEMFALSEOne table referred