SQL avançado em HSQLDB


create table distribuicao(
   id int not null,
   date timestamp default now,
   cpf varchar(9) not null,
   material int not null,
   FOREIGN KEY (cpf) REFERENCES usuario(cpf),
   FOREIGN KEY (material) REFERENCES material(id),
   Primary key (id)
);


Para valor padrão em campo de data:
date timestamp default now,

Para chave primária:
Primary key (id)

Para chave estrangeira:
FOREIGN KEY (material) REFERENCES material(id),

Comentários