MOSTRAR COLUNAS
Aplica-se a: do SQL do Databricks Databricks Runtime
Devolve a lista de colunas numa tabela. Se a tabela não existir, é emitida uma exceção.
Sintaxe
SHOW COLUMNS { IN | FROM } table_name [ { IN | FROM } schema_name ]
Nota
IN
Palavras-chave e FROM
intercambiáveis.
Parâmetros
-
Identifica a tabela. O nome não pode incluir uma especificação temporal.
-
Uma alternativa opcional para qualificar o
table_name
com um nome de esquema. Quando este parâmetro é especificado, o nome da tabela não deve ser qualificado com um nome de esquema diferente.
Exemplos
-- 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