Re: Mysql and FOREIGN KEY

2007-02-21 Thread Nils Meyer

Hi,

Micol lupen wrote:

FOREIGN
KEY(of_idvillaggio),REFERENCES villaggio(idvillaggio)

^^^ check here!

ON UPDATE CASCADE ON DELETE RESTRICT)ENGINE=INNODB;


No comma before REFERENCES. REFERENCES is part of the foreign key 
definition.


regards
Nils

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Mysql and FOREIGN KEY

2007-02-21 Thread Gerald L. Clark

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

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]