On Sat, 6 May 2006, kernel.alert kernel.alert wrote:
> I create the follow tables...
>
> --------------------------------------------------------
>
> CREATE TABLE empresa (
> id_empresa integer NOT NULL primary key,
> nombre varchar(45),
> );
> CREATE TABLE casino (
> id_casino integer NOT NULL,
> id_empresa integer REFERENCES empresa(id_empresa),
>
> nombre varchar(45),
>
> primary key(id_casino,id_empresa)
> );
> CREATE TABLE maq_casino (
> id_empresa integer NOT NULL REFERENCES casino(id_empresa),
> id_casino integer NOT NULL REFERENCES casino(id_casino),
You probably want a table level constraint like:
foreign key (id_casino, id_empresa) references casino(id_casino,
id_empresa)
That's not the same as two single-column constraints which is what you
have above.