I had an error in creating a FOREIGN KEY. I'd like to know what I'm doing wrong. Well, I've been trying for some time to find out what the error is. Thank you Annex code 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;