Tree structure data in HSQLDB

2011-02-04 oracle hsqldb

In my project, I need to maintain data in tree hierarchy.

Below code is something which I can do in Oracle.

Can the same be done in HSQLDB?

create table corporate_slaves ( slave_id integer primary key, supervisor_id references corporate_slaves, name varchar(100) );

If I use the same code, I get "Unexpected token: REFERENCES, error code: -5581" in HSQLDB.

Can anyone suggest how to build this kind of table?

Regards,

Satya

Answers

create table corporate_slaves (
  slave_id integer primary key,
  supervisor_id integer,
  name varchar(100),
  foreign key (supervisor_id) references corporate_slaves(slave_id)
);

Related