Al momento de ocupar el volcado sql me arroja el siguiente error:
Código:
leyendo en google encontre que ese problema se debe a que auto_increment solo funciona con claves primarias.MySQL ha dicho: Documentación #1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
existira alguna forma de utilizarlo con claves foraneas?
gracias
Código PHP:
drop database if exists familia;
create database familia;
use familia;
drop table if exists HIJOS;
drop table if exists PADRE;
create table HIJOS
(
COD_HIJOS INT(11) not null AUTO_INCREMENT,
COD_PADRE INT(11) AUTO_INCREMENT,
NOMBRE CHAR(60),
primary key (COD_HIJOS)
)
type = InnoDB;
create table PADRE
(
COD_PADRE INT(11)AUTO_INCREMENT not
null,
NOMBRE CHAR(60),
EDAD CHAR(30),
primary key (COD_PADRE)
)
type = InnoDB;
alter table HIJOS add constraint FK_PADRE foreign key (COD_PADRE)
references PADRE(COD_PADRE) on delete restrict on update
restrict;