Dean
Dean

Reputation: 9118

How do I specify multiple sort key columns?

This question here indicates that you can have multiple sort key columns. However, I can not figure out the correct syntax. This works fine for one column:

create table elt.tmptmp (
  val1 smallint sortkey,
  val2 smallint,
);

This is how I'd assume it would work for multiple columns, but it results in an error:

create table elt.tmptmp (
  val1 smallint,
  val2 smallint,
  sortkey(val1, val2)
);

ERROR: syntax error at or near "("

How do I specify a sort key on multiple columns?

Upvotes: 0

Views: 2458

Answers (1)

NoChance
NoChance

Reputation: 5752

create table tablename (...) sortkey (..., ...);

in your case, this should work:

create table elt.tmptmp (
  val1 smallint,
  val2 smallint,
)  
sortkey(val1, val2);

as in Create Table - Amazon.

Upvotes: 4

Related Questions