List:General Discussion« Previous MessageNext Message »
From:Gerald L. Clark Date:February 21 2007 4:03pm
Subject:Re: Mysql and FOREIGN KEY
View as plain text  
Micol lupen wrote:
> Hi to all,
> I am a student, i am studing Mysql FOREIGN KEY for to
> do a little progect, but i have this problem:
> i create this table:
> CREATE TABLE Cliente( codcliente VARCHAR(6) NOT NULL,
> nome VARCHAR(10) NOT NULL,cognome VARCHAR(20) NOT
> NULL, citta VARCHAR(10), indirizzo VARCHAR(20), tel
> VARCHAR(7) NOT NULL, PRIMARY KEY
> (codcliente))ENGINE=INNODB;
> 
> CREATE TABLE villaggio (idvillaggio INT
> AUTO_INCREMENT, nome VARCHAR(15) NOT NULL, stato
> VARCHAR(3) NOT NULL, descrizione VARCHAR(30),PRIMARY
> KEY(idvillaggio)) ENGINE=INNODB;
> 
> but when i create this table:
> CREATE TABLE offerta(idofferta INT
> AUTO_INCREMENT,of_idvillaggio INT NOT NULL,
> INDEX(of_idvillaggio),FOREIGN
> KEY(of_idvillaggio),REFERENCES villaggio(idvillaggio)
> ON UPDATE CASCADE ON DELETE RESTRICT)ENGINE=INNODB;
> 
> i have this error: REFERENCES error control manual 
> p.s. table villaggio is father and table offerta is
> children 
> 
> i see the manual but i don't see error, help me !!!
> 
> excuse me for my bad english
> Best Regads
> Antonio
> 
> _____________________ 
> L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
> http://it.docs.yahoo.com/nowyoucan.html
> 
of_idvillaggio INT NOT NULL
idvillaggio INT

These are not the same type.

-- 
Gerald L. Clark
Supplier Systems Corporation
Thread
Mysql and FOREIGN KEYMicol lupen21 Feb
  • Re: Mysql and FOREIGN KEYGerald L. Clark21 Feb
  • Re: Mysql and FOREIGN KEYNils Meyer21 Feb