Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/06/2008, 16:04
baciado
 
Fecha de Ingreso: junio-2008
Mensajes: 24
Antigüedad: 15 años, 10 meses
Puntos: 0
Tabla con llaves foraneas

Hola!

Soy muy nuevo con esto de Mysql y he tenido problemas especialmente al realizar tablas con llaves foraneas.

Al tratar de crear una tabla como sigue..

mysql> CREATE TABLE equipo (
-> idequipo int not null auto_increment,
-> idpropietario int not null,
-> equipomz varchar(50) not null,
-> equipomzid int not null,
-> usuariomz varchar(50) not null,
-> usuariomzid int not null,
-> idpais int not null,
-> iddivliga int not null,
-> idedoequipo int not null,
-> primary key(idequipo),
->
-> key (idpropietario),
-> foreign key (idpropietario)
-> references propietario(idpropietario)
-> ON DELETE NO ACTION
-> ON UPDATE CASCADE,
->
-> key (idpais),
-> foreign key (idpais)
-> references pais(idpais)
-> ON DELETE NO ACTION
-> ON UPDATE CASCADE,
->
-> key (iddivliga),
-> foreign key (iddivliga)
-> references iddivliga(iddivliga)
-> ON DELETE NO ACTION
-> ON UPDATE CASCADE,
->
-> key (idedoequipo),
-> foreign key (idedoequipo)
-> references edoequipo(idedoequipo)
-> ON DELETE NO ACTION
-> ON UPDATE CASCADE
-> ) ENGINE = INNODB;
ERROR 1005 (HY000): Can't create table './copa/equipo.frm' (errno: 150)

He intentado con los ejemplos que estan en algunas paginas y no he tenido mayor problema con las llaves foraneas pero al tratar de hacer mi tabla no puedo.

Ojala me puedan ayudar y aclarar el panorama.