He tenido un error en la creación de una FOREIGN KEY. Quisiera saber que estoy haciendo mal. Pues llevo bastante tiempo tratando de saber cual es el error. Gracias Anexo codigo Sql:
CREATE DATABASE freatico;
USE freatico;
CREATE TABLE medicion (
ID int(4) AUTO_INCREMENT PRIMARY KEY,
IDP int(4) not null,
Nivel float(5) not null,
Hora time not null,
Fecha date not null,
Persona text(40) not null,
SMS varchar(70) not null,
FOREIGN KEY(IDP) REFERENCES puntos(Id)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE puntos (
Id int(4) PRIMARY KEY not null,
Localizacion text(35) not null,
UltiMed float(5) not null,
Vreferencia float(5) not null,
AlTubo float(5) not null,
SMS varchar(60) not null
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE usuarios (
ID int(4) AUTO_INCREMENT PRIMARY KEY,
Nombre text(40) not null,
Correo varchar(50)not null,
Username varchar(20) not null,
Password varchar(40) not null,
Cargo text(50) not null
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;