SHOW COLUMNS
適用於:Databricks SQL
Databricks Runtime
傳回資料表中的欄位清單。 如果數據表不存在,則會拋出例外狀況。
Syntax
SHOW COLUMNS { IN | FROM } table_name [ { IN | FROM } schema_name ]
注意
IN
關鍵詞和 FROM
是可互換的。
參數
-
識別表格。 名稱不得包含 時態規格或選項規格。
-
使用架構名稱來限定
table_name
的可選替代方式。 指定此參數時,數據表名稱不應以不同的架構名稱限定。
範例
-- Create `customer` table in the `salessc` schema;
> USE SCHEMA salessc;
> CREATE TABLE customer(
cust_cd INT,
name VARCHAR(100),
cust_addr STRING);
-- List the columns of `customer` table in current schema.
> SHOW COLUMNS IN customer;
col_name
---------
cust_cd
name
cust_addr
-- List the columns of `customer` table in `salessc` schema.
> SHOW COLUMNS IN salessc.customer;
col_name
---------
cust_cd
name
cust_addr
-- List the columns of `customer` table in `salesdb` schema
> SHOW COLUMNS IN customer IN salessc;
col_name
---------
cust_cd
name
cust_addr