# SHOW CREATE TABLE

Shows the `CREATE TABLE` statement that was used to create the table.

## Syntax

```
SHOW CREATE TABLE table_name

```

## Arguments

**table\_name**

The name of the table.

## Remarks

* This command can be run on any SingleStore node (see [Node Requirements for SingleStore Commands](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands.md)).
* Beginning with version 7.3, conditional comments are removed by default. To enable conditional comments, use the [show\_with\_portabililty\_comments](https://docs.singlestore.com/db/v9.1/reference/configuration-reference/engine-variables/list-of-engine-variables/#sync-variables-lists.md) variable.
* See the [Permission Matrix](https://docs.singlestore.com/db/v9.1/reference/sql-reference/security-management-commands/permissions-matrix.md) for the required permission.

## Examples

## Example 1

The following example shows the output of `SHOW CREATE TABLE` for a rowstore table with sparse compression.

Create the table:

```sql
CREATE ROWSTORE TABLE table_1(a INT, b DECIMAL) COMPRESSION = SPARSE;

```

Show the table:

```sql
SHOW CREATE TABLE table_1;

```

Output of the “Create Table” column for the `table_1` row:

```
CREATE ROWSTORE TABLE `table_1` (
  `a` int(11) DEFAULT NULL,
  `b` decimal(10,0) DEFAULT NULL
  , SHARD KEY () 
) AUTOSTATS_CARDINALITY_MODE=PERIODIC AUTOSTATS_HISTOGRAM_MODE=CREATE SQL_MODE='STRICT_ALL_TABLES'
  COMPRESSION=SPARSE

```

## Example 2

The following example shows the output of `SHOW CREATE TABLE` for a columnstore table.

Create the table:

```sql
CREATE TABLE table_2(a INT, b VARCHAR(50), SORT KEY(b));

```

Show the table:

```sql
SHOW CREATE TABLE table_2;

```

Output of the “Create Table” column for the `table_2` row:

```
CREATE TABLE `table_2` (
  `a` int(11) DEFAULT NULL,
  `b` varbinary(50) DEFAULT NULL,
  KEY `b` (`b`) USING CLUSTERED COLUMNSTORE
  , SHARD KEY () 
) AUTOSTATS_CARDINALITY_MODE=INCREMENTAL AUTOSTATS_HISTOGRAM_MODE=CREATE AUTOSTATS_SAMPLING=ON SQL_MODE='STRICT_ALL_TABLES'

```

***

Modified at: January 11, 2023

Source: [/db/v9.1/reference/sql-reference/show-commands/show-create-table/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/show-commands/show-create-table/)

(An index of the documentation is available at /llms.txt)
