CREATE TABLE admin_user (
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY
);
CREATE TABLE mappa (
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
id_utente INT(11) NOT NULL,
data_creazione timestamp NOT NULL default CURRENT_TIMESTAMP,
foreign key(id_utente) references admin_user(id) on delete cascade on update no action
);
The second table gives me this error:
Can't create table db
.mappa
(errno: 150 "Foreign key constraint is incorrectly formed")
What is wrong in the key syntax mysql reference?