DESCRIBE VIEW

描述视图(或表)中的列。

DESCRIBE 可以缩写为 DESC。

另请参阅:

DROP VIEWALTER VIEWCREATE VIEWSHOW VIEWS

DESCRIBE TABLE

语法

DESC[RIBE] VIEW <name>
Copy

参数

name

指定要描述的视图的标识符。如果标识符包含空格或特殊字符,则整个字符串必须放在双引号内。放在双引号内的标识符也区分大小写。

使用说明

  • 命令输出不包括视图定义。请改用 SHOW VIEWS

  • DESC VIEW 和 DESCRIBE TABLE 可互换。任一命令检索与语句中的条件匹配的表或视图的详细信息。

  • 输出返回一个 POLICY NAME 列,用于指示在列上设置的 掩码策略

    如果未在该列上设置掩码策略,或者 Snowflake 账户不是 Enterprise Edition 或更高版本,Snowflake 将返回 NULL

  • To post-process the output of this command, you can use the pipe operator (->>) or the RESULT_SCAN function. Both constructs treat the output as a result set that you can query.

    The output column names for this command are generated in lowercase. If you consume a result set from this command with the pipe operator or the RESULT_SCAN function, use double-quoted identifiers for the column names in the query to ensure that they match the column names in the output that was scanned. For example, if the name of an output column is type, then specify "type" for the identifier.

示例

示例设置:

CREATE VIEW emp_view AS SELECT id "Employee Number", lname "Last Name", location "Home Base" FROM emp;
Copy

描述视图:

DESC VIEW emp_view;

+-----------------+--------------+--------+-------+---------+-------------+------------+-------+------------+---------+-------------+-----------------+
| name            | type         | kind   | null? | default | primary key | unique key | check | expression | comment | policy name |  privacy domain |
|-----------------+--------------+--------+-------+---------+-------------+------------+-------+------------+---------+-------------+-----------------+
| Employee Number | NUMBER(38,0) | COLUMN | Y     | NULL    | N           | N          | NULL  | NULL       | NULL    | NULL        | NULL            |
| Last Name       | VARCHAR(50)  | COLUMN | Y     | NULL    | N           | N          | NULL  | NULL       | NULL    | NULL        | NULL            |
| Home Base       | VARCHAR(100) | COLUMN | Y     | NULL    | N           | N          | NULL  | NULL       | NULL    | NULL        | NULL            |
+-----------------+--------------+--------+-------+---------+-------------+------------+-------+------------+---------+-------------+-----------------+
Copy
语言: 中文