顯示資料行

適用于:核取標示為是 Databricks SQL 檢查標示為是 Databricks Runtime

傳回資料表中的資料行清單。 如果資料表不存在,則會擲回例外狀況。

語法

SHOW COLUMNS { IN | FROM } table_name [ { IN | FROM } schema_name ]

注意

IN關鍵字和 FROM 是可交換的。

參數

  • table_name

    識別資料表。 名稱不得包含 時態規格

  • schema_name

    選擇性的替代方法,表示使用架構名稱來限定 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