SHOW CREATE TABLE - Amazon Athena
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

SHOW CREATE TABLE

Analyzes an existing table named table_name to generate the query that created it.

Synopsis

SHOW CREATE TABLE [db_name.]table_name

Parameters

TABLE [db_name.]table_name

The db_name parameter is optional. If omitted, the context defaults to the current database.

Note

The table name is required.

Examples

SHOW CREATE TABLE orderclickstoday;
SHOW CREATE TABLE `salesdata.orderclickstoday`;

Troubleshooting

If you use the Amazon Glue CreateTable API operation or the Amazon CloudFormation AWS::Glue::Table template to create a table for use in Athena without specifying the TableType property and then run a DDL query like SHOW CREATE TABLE or MSCK REPAIR TABLE, you can receive the error message FAILED: NullPointerException Name is null.

To resolve the error, specify a value for the TableInput TableType attribute as part of the Amazon Glue CreateTable API call or Amazon CloudFormation template. Possible values for TableType include EXTERNAL_TABLE or VIRTUAL_VIEW.

This requirement applies only when you create a table using the Amazon Glue CreateTable API operation or the AWS::Glue::Table template. If you create a table for Athena by using a DDL statement or an Amazon Glue crawler, the TableType property is defined for you automatically.