Dela via


SHOW COLUMNS

Gäller för:markerad ja Databricks SQL markerad ja Databricks Runtime

Returnerar list för columns i en table. Om table inte finns genereras ett undantag.

Syntax

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

Kommentar

Nyckelord IN och FROM är utbytbara.

Parameters

Exempel

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