Error 1005 (hy000): can't create table reparto.simone (errno

di il
7 risposte

Error 1005 (hy000): can't create table reparto.simone (errno

Raga sono nuovo nel forum...non so se sono nella sezione giusta...ho un problema, penso di foreign key, sulla creazione di un database per un progetto all'università...vi posto le mie tabelle... il problema me lo da sulla tabella reparto... mi da l'errore scritto come titolo...

Create table film (
anno_produzione integer not null,
titolo char not null,
versione char,
fascia_appartenenza char,
primary key (anno_produzione, titolo),
unique (titolo));

create table abbonamento (
cod integer primary key not null,
Tipo char,
Sconto integer,
Data_reg datetime,
Ncopie integer,
Durata char,
unique (cod));

create table regione (
nome char primary key not null,
unique (nome));

create table distributore (
pi integer primary key not null);

create table lingua (
nome char primary key not null);


create table provincia (
nome char primary key not null,
nome_regione char ,
foreign key (nome_regione) references regione (nome),
unique (nome));

create table citta (
nome char primary key not null,
nome_provincia char,
pi_distributore integer,
foreign key (nome_provincia) references provincia (nome),
foreign key (pi_distributore) references distributore (pi),
unique (nome));

create table servicepoint (
pi integer primary key not null,
pi_distributore integer,
nome_citta char,
foreign key (pi_distributore) references distributore (pi),
foreign key (nome_citta) references citta (nome),
unique (pi));

create table copiafisica (
supporto char not null,
titolo_film char not null,
anno_produzione_film integer not null,
primary key (supporto, titolo_film, anno_produzione_film),
foreign key (titolo_film) references film (titolo),
foreign key (anno_produzione_film) references film (anno_produzione));

create table magazzino (
via char not null,
numero_civico integer not null,
pi_servicepoint integer not null,
nome_citta char,
primary key (via, numero_civico, pi_servicepoint),
foreign key (pi_servicepoint) references servicepoint (pi),
foreign key (nome_citta) references citta (nome),
unique (via, numero_civico));

create table reparto (
nome char primary key not null,
numero_civico_magazzino integer,
via_magazzino char,
foreign key (numero_civico_magazzino) references magazzino (numero_civico),
foreign key (via_magazzino) references magazzino (via));


la seconda foreign key di reparto me la fa creare...la prima no...perchèèèèè

aspetto una vostra cortese risposta raga!! grazie mille in anticipo

7 Risposte

Devi accedere o registrarti per scrivere nel forum
7 risposte