如何查找架构中所有视图的行数?

How to find the number of rows for all views in a schema?

有时我可以访问具有数百个视图的模式(使用 Snowflake 数据市场时)。如何找到每个视图的行数?

我需要的是一种有效的方法来执行以下操作:

select count(*)
from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABORIGINAL_POP_PROJ";

...但对于该 Knoema 模式中的所有视图。

从表的 INFORMATION_SCHEMA 中获取行数很简单,但对于视图则不然。

相反,您需要从 INFORMATION_SCHEMA 中获取所有视图的名称,然后为每个视图构造一个查询 运行 COUNT(*)

select listagg(xx, ' union all ')
from (
    select 'select count(*) c, \'' || x || '\' v from ' || x as xx
    from (
        select TABLE_CATALOG ||'.'|| TABLE_SCHEMA ||'."'||TABLE_NAME||'"' x
        from  KNOEMA_FORECAST_DATA_ATLAS.INFORMATION_SCHEMA.VIEWS
        where table_schema='FORECAST'
    )
)

该查询的结果如下所示:

select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABORIGINAL_POP_PROJ"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABORIGINAL_POP_PROJ" 
union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABORIGINAL_POP_PROJ_REMOTE"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABORIGINAL_POP_PROJ_REMOTE" 
union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABS_ABORIGINAL_POPPROJ_INDREGION"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABS_ABORIGINAL_POPPROJ_INDREGION" 
union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABS_FAMILY_PROJ"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABS_FAMILY_PROJ" 
union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABS_HH_PROV"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABS_HH_PROV" 
union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABS_PERSONS_PROJ"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ABS_PERSONS_PROJ" 
union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ACT2015"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ACT2015" 
union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."APWSCR2019"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."APWSCR2019" 
union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ASEANEO2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ASEANEO2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ASEANEO2020Dec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ASEANEO2020Dec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."AUSFCRAE2020Dec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."AUSFCRAE2020Dec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."AUSFCRAE2020Sep"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."AUSFCRAE2020Sep" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."BALEA2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."BALEA2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."BLSIOM2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."BLSIOM2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."BREXRATE2019"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."BREXRATE2019" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CAESD2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CAESD2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CBIMISUCBAPHLE2012"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CBIMISUCBAPHLE2012" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CBOTPEF2020Sep"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CBOTPEF2020Sep" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CBS83558ENG"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CBS83558ENG" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CEAICPS2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CEAICPS2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."COCERALGCF2020Dec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."COCERALGCF2020Dec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CS2016"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."CS2016" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."DOSIPIX2019MAY"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."DOSIPIX2019MAY" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."DSTHST5"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."DSTHST5" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EAP_2EAP_SEX_AGE_GEO_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EAP_2EAP_SEX_AGE_GEO_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EAP_2EAP_SEX_AGE_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EAP_2EAP_SEX_AGE_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EAP_2MDN_SEX_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EAP_2MDN_SEX_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EAP_2WAP_SEX_AGE_RT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EAP_2WAP_SEX_AGE_RT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ECBRMP2020Dec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ECBRMP2020Dec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIAAEO2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIAAEO2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIAAEO2021"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIAAEO2021" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIASTEO2021JAN"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIASTEO2021JAN" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIP_2EET_SEX_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIP_2EET_SEX_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIP_2EIP_SEX_AGE_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIP_2EIP_SEX_AGE_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIP_2PLF_SEX_AGE_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIP_2PLF_SEX_AGE_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIP_2WAP_SEX_AGE_RT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EIP_2WAP_SEX_AGE_RT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_AGE_STE_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_AGE_STE_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_AGE_CLA_DT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_AGE_CLA_DT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_AGE_CLA_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_AGE_CLA_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_AGE_GEO_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_AGE_GEO_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_AGE_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_AGE_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_ECO_DT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_ECO_DT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_ECO_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_ECO_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_GEO_ECO_DT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_GEO_ECO_DT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_GEO_ECO_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_GEO_ECO_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_GEO_OCU_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_GEO_OCU_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_GEO_STE_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_GEO_STE_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_OCU_DT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_OCU_DT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_OCU_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_OCU_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_STE_DT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_STE_DT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_STE_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2EMP_SEX_STE_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2WAP_SEX_AGE_RT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EMP_2WAP_SEX_AGE_RT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EO103_LTB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EO103_LTB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EO107_INTERNET_1"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EO107_INTERNET_1" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EO107_INTERNET_2"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EO107_INTERNET_2" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EPIPHS2015"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."EPIPHS2015" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAAAFUSRC2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAAAFUSRC2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGBCR2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGBCR2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGCOS2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGCOS2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGCR2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGCR2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGEF2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGEF2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGMAS2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGMAS2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGMM2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGMM2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGSF2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAOEMAGSF2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAPRIAGR2020AUG"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAPRIAGR2020AUG" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAPRIAGR2020JUN"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FAPRIAGR2020JUN" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FSS2014"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."FSS2014" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."GDP_205U_NOC_NB_R"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."GDP_205U_NOC_NB_R" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."GDP_211P_NOC_NB_R"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."GDP_211P_NOC_NB_R" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."GEI2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."GEI2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."GL_BEXSAT1"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."GL_BEXSAT1" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ICCOMEODFPR"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ICCOMEODFPR" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IDPOPULAN2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IDPOPULAN2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IEAOMR2020Aug"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IEAOMR2020Aug" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IEAOMR2020Oct"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IEAOMR2020Oct" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IEAOMR2020Sep"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IEAOMR2020Sep" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IFDEA2015"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IFDEA2015" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IMFAPDREO2020Apr"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IMFAPDREO2020Apr" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IMFFM2020Oct"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IMFFM2020Oct" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IMFOWEO2020Oct"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IMFOWEO2020Oct" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IMFOWEO2021Jan"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IMFOWEO2021Jan" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IMFWEO2020Oct"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IMFWEO2020Oct" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."INPHAP2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."INPHAP2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."INVPIONRR2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."INVPIONRR2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IS_DCIS_PREVDEM1"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."IS_DCIS_PREVDEM1" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."JPLSBCS2017"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."JPLSBCS2017" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."KOSISKRDEM2019"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."KOSISKRDEM2019" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."LUU_2LU2_SEX_AGE_GEO_RT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."LUU_2LU2_SEX_AGE_GEO_RT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."LUU_2LU4_SEX_AGE_GEO_RT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."LUU_2LU4_SEX_AGE_GEO_RT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."LUU_2LU4_SEX_AGE_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."LUU_2LU4_SEX_AGE_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."LUU_2LU4_SEX_AGE_RT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."LUU_2LU4_SEX_AGE_RT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."MOSPDSI2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."MOSPDSI2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."MYPLF2017"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."MYPLF2017" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."NDCTAIPOP2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."NDCTAIPOP2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."NSS2014"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."NSS2014" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."OCEDUTT2019"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."OCEDUTT2019" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."OCRD2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."OCRD2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."OPECOSDEP2020Dec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."OPECOSDEP2020Dec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."OPECOSDEP2021Jan"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."OPECOSDEP2021Jan" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."PAG"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."PAG" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POPPROJ"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POPPROJ" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POPULATION_CLOCK_FY"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POPULATION_CLOCK_FY" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POP_2LDR_NOC_RT_R"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POP_2LDR_NOC_RT_R" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POP_2POP_GEO_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POP_2POP_GEO_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POP_2POP_SEX_AGE_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POP_2POP_SEX_AGE_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POP_PROJ"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POP_PROJ" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POP_PROJ_2011"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."POP_PROJ_2011" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."RBIHINRR2016"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."RBIHINRR2016" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."SDG_0111_SEX_AGE_RT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."SDG_0111_SEX_AGE_RT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."SDG_0852_SEX_AGE_RT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."SDG_0852_SEX_AGE_RT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."SWENGAUG2019"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."SWENGAUG2019" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."TXECFR2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."TXECFR2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."TXERSVR2020Dec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."TXERSVR2020Dec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."UNE_2EAP_SEX_AGE_RT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."UNE_2EAP_SEX_AGE_RT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."UNE_2UNE_SEX_AGE_NB"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."UNE_2UNE_SEX_AGE_NB" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."UNWUP2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."UNWUP2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBLONPROSEP2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBLONPROSEP2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBOTFP2020Sep"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBOTFP2020Sep" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBUDESTATSTAB2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBUDESTATSTAB2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBUDPROJOCT2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBUDPROJOCT2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBUDREVN2020Sep"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBUDREVN2020Sep" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBUDREVNAUG2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBUDREVNAUG2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBUDSPENDPJSEP2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCBUDSPENDPJSEP2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCECOPRO2020Jul"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCECOPRO2020Jul" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCECOPRO2021Feb"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCECOPRO2021Feb" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCLPR2019Dec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCLPR2019Dec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCOVIDHONPJ2020NOV"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USCOVIDHONPJ2020NOV" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDACPFC2020Dec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDACPFC2020Dec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAIME2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAIME2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAIME2021"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAIME2021" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAPSD2020Dec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAPSD2020Dec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAPSD2020RDec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAPSD2020RDec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAPSD2021Jan"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAPSD2021Jan" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDARAYP2017"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDARAYP2017" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAWGST2020Dec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USDAWGST2020Dec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USEDO2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USEDO2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USEMS2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USEMS2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USFTR2017"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USFTR2017" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USNEMO2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USNEMO2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWETPOP2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWETPOP2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHBBA2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHBBA2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHOCIOBSM2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHOCIOBSM2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHOFD2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHOFD2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHOMSRS2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHOMSRS2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHOOBEMRDP2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHOOBEMRDP2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHOOPI2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."USWHOOPI2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBCB2020OCT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBCB2020OCT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBDB2019"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBDB2019" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBEDS2017Jun"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBEDS2017Jun" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBFUTUREGCM2019"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBFUTUREGCM2019" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBGEPGC2021Jan"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBGEPGC2021Jan" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBIDS2018"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBIDS2018" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBPEP2018Oct"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WBPEP2018Oct" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WESP2021"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WESP2021" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WHOGHO2020OCT"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WHOGHO2020OCT" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WHTDRCOP2020Dec"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WHTDRCOP2020Dec" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WHTDRCOP2020Nov"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WHTDRCOP2020Nov" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WHTDRCOP2021Jan"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WHTDRCOP2021Jan" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WLDBPEOCDP2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WLDBPEOCDP2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WOERDP2020"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WOERDP2020" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WOERDP2021"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WOERDP2021" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WSSRO2020Oct"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WSSRO2020Oct" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WTTC2019"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."WTTC2019" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."dbsamid"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."dbsamid" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."drrskf"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."drrskf" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."elnqwwd"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."elnqwwd" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."fbjgwqg"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."fbjgwqg" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."hznlzr"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."hznlzr" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ichpxy"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."ichpxy" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."nstmflb"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."nstmflb" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."tps00002-20170615"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."tps00002-20170615" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."tps00153"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."tps00153" union all select count(*) c, 'KNOEMA_FORECAST_DATA_ATLAS.FORECAST."tps00200-20190703"' v from KNOEMA_FORECAST_DATA_ATLAS.FORECAST."tps00200-20190703"

现在您需要执行该查询:通过复制粘贴或使用存储过程。

如果要对结果进行排序,请在末尾添加一个order by c desc

结果将如下所示:

如果您想添加额外的信息,例如信息模式中每个视图的描述,您可以扩充生成的查询:

select listagg(xx, ' union all ')
from (
    select 'select count(*) c, \''||comment||'\' comment, \'' || x || '\' v from ' || x as xx
    from (
        select TABLE_CATALOG ||'.'|| TABLE_SCHEMA ||'."'||TABLE_NAME||'"' x, comment
        from  KNOEMA_FORECAST_DATA_ATLAS.INFORMATION_SCHEMA.VIEWS
        where table_schema='FORECAST'
    )
)

运行 宁结果查询的结果如下: