Syntax

SHOW CREATE TABLE table_name;

Parameters

ParameterDescription
table_nameThe table to show the query of.

Example

CREATE TABLE IF NOT EXISTS taxi_trips(
    id VARCHAR,
    distance DOUBLE PRECISION,
    city VARCHAR
) WITH (appendonly = 'true');

SHOW CREATE TABLE taxi_trips;

Here is the result. Note that the IF NOT EXISTS clause is omitted while the WITH option is preserved.

   Name    |                 Create Sql
-----------+---------------------------------------------
 public.taxi_trips | CREATE TABLE taxi_trips (id CHARACTER VARYING, distance DOUBLE, city CHARACTER VARYING) WITH (appendonly = 'true')
(1 row)