Ver Mensaje Individual
  #9 (permalink)  
Antiguo 10/04/2005, 21:27
luchope
 
Fecha de Ingreso: julio-2003
Ubicación: Colombia
Mensajes: 591
Antigüedad: 23 años, 3 meses
Puntos: 7
La forma correcta de crear una estructura referencial en Mysql es esta...


Código PHP:
CREATE TABLE parent(id INT NOT NULL,
                    
PRIMARY KEY (id)
) 
TYPE=INNODB;

CREATE TABLE child(id INT, parent_id INT,
                   
INDEX par_ind (parent_id),
                   
FOREIGN KEY (parent_id) REFERENCES parent(id)
                     
ON DELETE CASCADE
) TYPE=INNODB; 

mientras que este tipo de definiciones es para M$SQL

Código PHP:
constraint pk_depto primary key(iddepto) 

Chaop!