> **Experimental**
>
> `@aws-cdk/aws-redshift-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# TableSortStyle

The sort style of a table.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/table.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-redshift-alpha/lib/table.ts#L403)

## Example

TypeScript:

```ts
new Table(this, 'Table', {
  tableColumns: [
    { name: 'col1', dataType: 'varchar(4)', sortKey: true },
    { name: 'col2', dataType: 'float', sortKey: true },
  ],
  cluster: cluster,
  databaseName: 'databaseName',
  sortStyle: TableSortStyle.COMPOUND,
});
```

Python:

```python
from aws_cdk.aws_redshift_alpha import Column, Column
Table(self, "Table",
    table_columns=[Column(name="col1", data_type="varchar(4)", sort_key=True), Column(name="col2", data_type="float", sort_key=True)
    ],
    cluster=cluster,
    database_name="databaseName",
    sort_style=TableSortStyle.COMPOUND
)
```

Java:

```java
Table.Builder.create(this, "Table")
        .tableColumns(List.of(Column.builder().name("col1").dataType("varchar(4)").sortKey(true).build(), Column.builder().name("col2").dataType("float").sortKey(true).build()))
        .cluster(cluster)
        .databaseName("databaseName")
        .sortStyle(TableSortStyle.COMPOUND)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Redshift.Alpha
new Table(this, "Table", new TableProps {
    TableColumns = new [] { new Column { Name = "col1", DataType = "varchar(4)", SortKey = true }, new Column { Name = "col2", DataType = "float", SortKey = true } },
    Cluster = cluster,
    DatabaseName = "databaseName",
    SortStyle = TableSortStyle.COMPOUND
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkredshiftalpha/v2
awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &TableProps{
	TableColumns: []Column{
		&Column{
			Name: jsii.String("col1"),
			DataType: jsii.String("varchar(4)"),
			SortKey: jsii.Boolean(true),
		},
		&Column{
			Name: jsii.String("col2"),
			DataType: jsii.String("float"),
			SortKey: jsii.Boolean(true),
		},
	},
	Cluster: cluster,
	DatabaseName: jsii.String("databaseName"),
	SortStyle: awscdkredshiftalpha.TableSortStyle_COMPOUND,
})
```

## Members

| Member | Description |
| --- | --- |
| `AUTO` | Amazon Redshift assigns an optimal sort key based on the table data. |
| `COMPOUND` | Specifies that the data is sorted using a compound key made up of all of the listed columns, in the order they are listed. |
| `INTERLEAVED` | Specifies that the data is sorted using an interleaved sort key. |

## Referenced by

- [`TableProps`](/v2/docs/@aws-cdk_aws-redshift-alpha.TableProps).sortStyle
