SHOW COLUMNS

Gilt für:durch Häkchen mit „Ja“ markiert Databricks SQL durch Häkchen mit „Ja“ markiert Databricks Runtime

Gibt die Liste der Spalten in einer Tabelle zurück. Wenn die Tabelle nicht vorhanden ist, wird eine Ausnahme ausgelöst.

Syntax

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

Hinweis

Die Schlüsselwörter IN und FROM sind austauschbar.

Parameter

  • table_name

    Bestimmt die Tabelle. Der Name darf keine temporale Spezifikation enthalten.

  • schema_name

    Eine optionale alternative Möglichkeit zum Qualifizieren von table_name mit einem Schemanamen. Wenn dieser Parameter angegeben wird, sollte der Tabellenname nicht mit einem anderen Schemanamen qualifiziert werden.

Beispiele

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