Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

SHOW TABLE

Focus mode
SHOW TABLE - Amazon Redshift

Shows the definition of a table, including table attributes, table constraints, column attributes, and column constraints. You can use the output of the SHOW TABLE statement to recreate the table.

For more information on table creation, see CREATE TABLE.

Syntax

SHOW TABLE [schema_name.]table_name

Parameters

schema_name

(Optional) The name of the related schema.

table_name

The name of the table to show.

Examples

Following is an example of the SHOW TABLE output for the table sales.

show table sales;
CREATE TABLE public.sales ( salesid integer NOT NULL ENCODE az64, listid integer NOT NULL ENCODE az64 distkey, sellerid integer NOT NULL ENCODE az64, buyerid integer NOT NULL ENCODE az64, eventid integer NOT NULL ENCODE az64, dateid smallint NOT NULL, qtysold smallint NOT NULL ENCODE az64, pricepaid numeric(8,2) ENCODE az64, commission numeric(8,2) ENCODE az64, saletime timestamp without time zone ENCODE az64 ) DISTSTYLE KEY SORTKEY ( dateid );

Following is an example of the SHOW TABLE output for the table category in the schema public.

show table public.category;
CREATE TABLE public.category ( catid smallint NOT NULL distkey, catgroup character varying(10) ENCODE lzo, catname character varying(10) ENCODE lzo, catdesc character varying(50) ENCODE lzo ) DISTSTYLE KEY SORTKEY ( catid );

The following example creates table foo with a primary key.

create table foo(a int PRIMARY KEY, b int);

The SHOW TABLE results display the create statement with all properties of the foo table.

show table foo;
CREATE TABLE public.foo ( a integer NOT NULL ENCODE az64, b integer ENCODE az64, PRIMARY KEY (a) ) DISTSTYLE AUTO;

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.