SHOW COLUMNS

适用于:勾选“是” Databricks SQL 勾选“是” Databricks Runtime

返回表中的列的列表。 如果该表不存在,则会引发异常。

语法

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

注意

关键字 INFROM 可互换。

参数

示例

-- 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