Hi,
The KEY form to specify an index at table definition time it's a
propietary implementation detail out of standards.
SQL is a descriptive language even the DDL part.

To get the same result just separate the index creation sentence in an
specific CREATE INDEX sentence like:

CREATE TABLE actor (
  actor_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
  first_name VARCHAR(45) NOT NULL,
  last_name VARCHAR(45) NOT NULL,
  last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY  (actor_id),
);

CREATE INDEX idx_actor_last_name in actor(last_name); 

See,  http://www.h2database.com/html/grammar.html#create_index

Regards
Dario


El 02/06/10 09:15, George escribió:
> I'm trying to use the MySQL demonstration database Sakila.  H2 does
> not like the "KEY" keyword, as used below.   Is there an H2
> equivalent?  I'm actually at a loss for what a non-primary key
> actually means at all (hint for creating an index, perhaps?)  Thanks.
>
>
> CREATE TABLE actor (
>   actor_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
>   first_name VARCHAR(45) NOT NULL,
>   last_name VARCHAR(45) NOT NULL,
>   last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
>   PRIMARY KEY  (actor_id),
>   KEY idx_actor_last_name (last_name)
> );
> Unknown data type: "IDX_ACTOR_LAST_NAME"; SQL statement:
>   


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to