-- Returns metadata for views in a single dataset.SELECT*FROMmyDataset.INFORMATION_SCHEMA.VIEWS;-- Returns metadata for all views in a region.SELECT*FROMregion-us.INFORMATION_SCHEMA.VIEWS;
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eThe \u003ccode\u003eINFORMATION_SCHEMA.VIEWS\u003c/code\u003e view provides metadata about views, with each row representing a single view in a dataset.\u003c/p\u003e\n"],["\u003cp\u003eTo access view metadata, users need specific IAM permissions, including \u003ccode\u003ebigquery.tables.get\u003c/code\u003e and \u003ccode\u003ebigquery.tables.list\u003c/code\u003e, which are included in predefined roles like \u003ccode\u003eroles/bigquery.admin\u003c/code\u003e, \u003ccode\u003eroles/bigquery.dataEditor\u003c/code\u003e, \u003ccode\u003eroles/bigquery.metadataViewer\u003c/code\u003e, and \u003ccode\u003eroles/bigquery.dataViewer\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eQueries against the \u003ccode\u003eINFORMATION_SCHEMA.VIEWS\u003c/code\u003e view must specify either a dataset or a region qualifier, requiring appropriate permissions for either the dataset or the project.\u003c/p\u003e\n"],["\u003cp\u003eThe schema of \u003ccode\u003eINFORMATION_SCHEMA.VIEWS\u003c/code\u003e includes columns such as \u003ccode\u003eTABLE_CATALOG\u003c/code\u003e, \u003ccode\u003eTABLE_SCHEMA\u003c/code\u003e, \u003ccode\u003eTABLE_NAME\u003c/code\u003e, \u003ccode\u003eVIEW_DEFINITION\u003c/code\u003e, and \u003ccode\u003eUSE_STANDARD_SQL\u003c/code\u003e, which detail the project, dataset, view name, view's SQL definition, and the SQL dialect used.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eINFORMATION_SCHEMA\u003c/code\u003e view names are case-sensitive, and when querying, the location of the query execution must match the region of the \u003ccode\u003eINFORMATION_SCHEMA\u003c/code\u003e view.\u003c/p\u003e\n"]]],[],null,["# VIEWS view\n==========\n\nThe `INFORMATION_SCHEMA.VIEWS` view contains metadata about views.\n\nRequired permissions\n--------------------\n\nTo get view metadata, you need the following Identity and Access Management (IAM)\npermissions:\n\n- `bigquery.tables.get`\n- `bigquery.tables.list`\n\nEach of the following predefined IAM roles includes the\npermissions that you need in order to get view metadata:\n\n- `roles/bigquery.admin`\n- `roles/bigquery.dataEditor`\n- `roles/bigquery.metadataViewer`\n- `roles/bigquery.dataViewer`\n\nFor more information about BigQuery permissions, see\n[Access control with IAM](/bigquery/docs/access-control).\n\nSchema\n------\n\nWhen you query the `INFORMATION_SCHEMA.VIEWS` view, the query results contain\none row for each view in a dataset.\n\nThe `INFORMATION_SCHEMA.VIEWS` view has the following schema:\n\nScope and syntax\n----------------\n\nQueries against this view must include a dataset or a region qualifier. For\nqueries with a dataset qualifier, you must have permissions for the dataset.\nFor queries with a region qualifier, you must have permissions for the project.\nFor more\ninformation see [Syntax](/bigquery/docs/information-schema-intro#syntax).\nThe following table explains the region and resource scopes for this view:\n\nReplace the following:\n\n- Optional: \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your Google Cloud project. If not specified, the default project is used.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: any [dataset region name](/bigquery/docs/locations). For example, ```region-us```.\n- \u003cvar translate=\"no\"\u003eDATASET_ID\u003c/var\u003e: the ID of your dataset. For more information, see [Dataset qualifier](/bigquery/docs/information-schema-intro#dataset_qualifier).\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n | **Note:** You must use [a region qualifier](/bigquery/docs/information-schema-intro#region_qualifier) to query `INFORMATION_SCHEMA` views. The location of the query execution must match the region of the `INFORMATION_SCHEMA` view.\n\n\u003cbr /\u003e\n\nFor example: \n\n -- Returns metadata for views in a single dataset.\n SELECT * FROM myDataset.INFORMATION_SCHEMA.VIEWS;\n\n -- Returns metadata for all views in a region.\n SELECT * FROM region-us.INFORMATION_SCHEMA.VIEWS;\n\nExamples\n--------\n\n##### Example 1:\n\nThe following example retrieves all columns from the `INFORMATION_SCHEMA.VIEWS`\nview except for `check_option` which is reserved for future use. The metadata\nreturned is for all views in `mydataset` in your default project ---\n`myproject`.\n\nTo run the query against a project other than your default project, add the\nproject ID to the dataset in the following format:\n```````\u003cvar translate=\"no\"\u003eproject_id\u003c/var\u003e````.```\u003cvar translate=\"no\"\u003edataset\u003c/var\u003e```.INFORMATION_SCHEMA.```\u003cvar translate=\"no\"\u003eview\u003c/var\u003e;\nfor example, ```myproject`.mydataset.INFORMATION_SCHEMA.VIEWS``. \n\n```googlesql\nSELECT\n * EXCEPT (check_option)\nFROM\n mydataset.INFORMATION_SCHEMA.VIEWS;\n```\n| **Note:** `INFORMATION_SCHEMA` view names are case-sensitive.\n\nThe result is similar to the following:\n\n\u003cbr /\u003e\n\n```\n +----------------+---------------+---------------+---------------------------------------------------------------------+------------------+\n | table_catalog | table_schema | table_name | view_definition | use_standard_sql |\n +----------------+---------------+---------------+---------------------------------------------------------------------+------------------+\n | myproject | mydataset | myview | SELECT column1, column2 FROM [myproject:mydataset.mytable] LIMIT 10 | NO |\n +----------------+---------------+---------------+---------------------------------------------------------------------+------------------+\n \n```\n\n\u003cbr /\u003e\n\nNote that the results show that this view was created by using a legacy SQL\nquery.\n\n##### Example 2:\n\nThe following example retrieves the SQL query and query syntax used to define\n`myview` in `mydataset` in your default project --- `myproject`.\n\nTo run the query against a project other than your default project, add the\nproject ID to the dataset in the following format:\n```````\u003cvar translate=\"no\"\u003eproject_id\u003c/var\u003e````.```\u003cvar translate=\"no\"\u003edataset\u003c/var\u003e```.INFORMATION_SCHEMA.```\u003cvar translate=\"no\"\u003eview\u003c/var\u003e;\nfor example, ```myproject`.mydataset.INFORMATION_SCHEMA.VIEWS``. \n\n```googlesql\nSELECT\n table_name, view_definition, use_standard_sql\nFROM\n mydataset.INFORMATION_SCHEMA.VIEWS\nWHERE\n table_name = 'myview';\n```\n| **Note:** `INFORMATION_SCHEMA` view names are case-sensitive.\n\nThe result is similar to the following:\n\n\u003cbr /\u003e\n\n +---------------+---------------------------------------------------------------+------------------+\n | table_name | view_definition | use_standard_sql |\n +---------------+---------------------------------------------------------------+------------------+\n | myview | SELECT column1, column2, column3 FROM mydataset.mytable | YES |\n +---------------+---------------------------------------------------------------+------------------+\n \n\u003cbr /\u003e\n\nNote that the results show that this view was created by using a\nGoogleSQL query."]]