

# SHOW CREATE SCALEOUT TABLE

Use `SHOW CREATE SCALEOUT TABLE` to read back the definition of a scaleout table in a database cluster group for Aurora.

## Description and syntax
<a name="databaseclustergroups-sql-show-create-scaleout-table-syntax"></a>

Returns the full definition of one scaleout table. On Aurora MySQL, the result has the columns `Scaleout Table` and `Create Scaleout Table`. The routing layer has no system table that lists scaleout tables, so this statement is the way to read a definition back.

```sql
SHOW CREATE SCALEOUT TABLE {{table_name}};
```

## Parameters and options
<a name="databaseclustergroups-sql-show-create-scaleout-table-parameters"></a>

The statement takes the following parameter.

{{table\_name}}  
The scaleout table to show. On Aurora MySQL, you can qualify it with a database, or select the database first with `USE`.

## Where it runs and required privileges
<a name="databaseclustergroups-sql-show-create-scaleout-table-privileges"></a>

Run the statement at the routing endpoint, in a session that isn't pinned. A pinned session passes the statement through to the member cluster unchanged. For the details, see [Where these statements run](databaseclustergroups-sql-reference.md#databaseclustergroups-sql-where-statements-run).

For the privilege that the statement needs, see [Privileges](databaseclustergroups-sql-reference.md#databaseclustergroups-sql-privileges).

## Usage notes
<a name="databaseclustergroups-sql-show-create-scaleout-table-usage"></a>

Keep the following in mind when you use the statement.
+ Read each definition back by name, and keep a copy with your export of the data mappings. To find the names, run [SHOW SCALEOUT TABLES](databaseclustergroups-sql-show-scaleout.md), or keep your own list.
+ `DESCRIBE SCALEOUT TABLE` isn't supported. Use this statement instead.
+ On Aurora MySQL, `DESCRIBE` and `SHOW COLUMNS` of a scaleout table return error 1146 unless you set [scaleout\_tables\_preferred\_member](databaseclustergroups-sql-set-scaleout-tables-preferred-member.md), which names the member table that answers them.

## Examples
<a name="databaseclustergroups-sql-show-create-scaleout-table-examples"></a>

The following example shows the definition of `orders` on Aurora MySQL, after it selects the database `db`.

```sql
USE db;
SHOW CREATE SCALEOUT TABLE orders;
```

## Errors
<a name="databaseclustergroups-sql-show-create-scaleout-table-errors"></a>

The statement can return the following errors. For all errors from the routing layer, see [Error codes for database cluster groups for Aurora](databaseclustergroups-error-reference.md).


| Aurora MySQL | Meaning | 
| --- | --- | 
| [1064](databaseclustergroups-errors-routing.md#databaseclustergroups-routing-and-statement-errors) | Syntax error, such as DESCRIBE SCALEOUT TABLE. | 
| [1146](databaseclustergroups-errors-routing.md#databaseclustergroups-routing-and-statement-errors) Table '<db>.<table>' doesn't exist | DESCRIBE or SHOW COLUMNS of a scaleout table with no preferred member table. Use SHOW CREATE SCALEOUT TABLE, or set a preferred member table. | 

## Related statements
<a name="databaseclustergroups-sql-show-create-scaleout-table-related"></a>

For more information, see the following:
+ [SHOW SCALEOUT TABLES](databaseclustergroups-sql-show-scaleout.md)
+ [CREATE SCALEOUT TABLE](databaseclustergroups-sql-create-scaleout-table.md)
+ [SET scaleout\_tables\_preferred\_member](databaseclustergroups-sql-set-scaleout-tables-preferred-member.md)
+ [SHOW CREATE SCALEOUT ROUTING FUNCTION](databaseclustergroups-sql-show-create-scaleout-routing-function.md)