Grammatica SQL tabella

Gli oggetti tabella supportano la grammatica SQL elencata per i carichi di lavoro DDL.

Oracle AI Data Platform Workbench supporta tutti i tipi di dati SQL Spark standard. Per ulteriori informazioni, vedere la documentazione Apache Spark - Tipi di dati supportati.

Operazione Grammatica
Crea tabella
CREATE [EXTERNAL] TABLE [IF NOT EXISTS] <catalog_name>.<schema-name>.<table-name>
[ ( <column1-name><column1-type> [comment <column1-comment>], ... ) ]
USING [HIVE|DELTA, CSV, TXT, ORC, JDBC, PARQUET, etc.]
[ options ( <key1>=<val1>[, ...]) ]
[ PARTITIONED BY (<par-column-name>[, ...]) ]
[ CLUSTERED BY ( <clus-column-name>[, ...])
    [ SORTED BY ( <sort-column-name> [ asc | desc ][, ...]) ]
    INTO <num_buckets> buckets]
[ LOCATION '<path>']
[TBLPROPERTIES ( DESCRIPTION = 'some-description', '<property-name>'='<property-value>'[, ...]) ]

Risposta:

<<SQL Command>> was successfully executed

Errore:

Error: <<SQL Command>> failed due to <<reason>>
Crea tabella gestita
Crea tabella gestita
CREATE TABLE <catalog>.<schema>.<table-name> [ ( <column1-name><column1-type> [comment <column1-comment>], ... ) ] USING <format>;

Risposta:

<<SQL Command>> was successfully executed
Errore:
Error: <<SQL Command>> failed due to <<reason>>
Crea tabella gestita con dati
create datatable <<catalog_name>>.<<schema_name>>.<<table_name>> [ ( <column1-name><column1-type> [comment <column1-comment>], ... ) ] tblproperties ('lakehouse_storage_format'='PARQUET') using parquet with select ( <column1-name>], ... ) from parquet.'oci://bucket@namespace/folder/'

Risposta:

<<SQL Command>> was successfully executed
Errore:
Error: <<SQL Command>> failed due to <<reason>>
Crea tabella con supporto uniforme
CREATE [EXTERNAL] TABLE [IF NOT EXISTS] <catalog_name>.<schema-name>.<table-name>
[ ( <column1-name> <column1-type> [comment <column1-comment>], ... ) ]
[TBLPROPERTIES ('delta.universalFormat.enabledFormats' = 'iceberg') ]
Altera tabella
ALTER TABLE table_old_name RENAME TO table_new_name
ALTER TABLE table_name ADD COLUMNS ( col_spec [ , ... ])
ALTER TABLE table_name DROP { COLUMN | COLUMNS } [ ( ] col_name [ , ... ] [ ) ]
ALTER TABLE table_name RENAME COLUMN col_name TO col_name
ALTER TABLE table_name ADD [IF NOT EXISTS] ( partition_spec [partition_spec ... ] )
ALTER TABLE table_name DROP [ IF EXISTS ] partition_spec [PURGE]
ALTER TABLE table_name set tblproperties (description ='some-description')
Elimina tabella
DROP TABLE [ IF EXISTS ] table_name [ PURGE ]

Risposta:

<<SQL Command>> was successfully executed

Errore:

Error: <<SQL Command>> failed due to <<reason>>
Elenca tabelle in uno schema
SHOW TABLES in catalog_name.schema_name [ LIKE <regex_pattern> ]

regex_pattern: pattern di espressione regolare utilizzato per filtrare i risultati dell'istruzione.

Risposta:
<<namesake>>,tableName,isTemporary

Errore:

<<SQL Command>> failed due to <<reason>>
Descrivi tabella
DESCRIBE TABLE [ FORMAT ] catalog_name.schema_name.table_name [ PARTITION (<partition_col_name> = <partition_col_val>, ...) ] [ catalog_name.schema_name.table_name.column_name ]

Formato: se si specifica EXTENDED come formato, vengono restituite ulteriori informazioni sui metadati, ad esempio il database padre, il proprietario e l'ora di accesso.

DESCRIBE TABLE catalog.schema.table Risposta:

col_name,data_type,comment
DESCRIBE TABLE catalog.schema.table column Risposta:
info_name,info_value