4
I’m having the same problem in every database. I have a database created with the following lines
create database nova;
create table estado(
id int primary key auto_increment,
nome varchar(20)
);
create table pessoa(
id int primary key auto_increment,
nome varchar(20),
estado int,
foreign key (estado) references estado(id)
);
And I want to delete the state field in the person table, I got the following errors when executing the following lines:
alter table pessoa drop estado
1553 - Cannot drop index 'statoAtuall': needed in a Foreign key Constraint
ALTER TABLE pessoa DROP INDEX estado;
ALTER TABLE pessoa DROP COLUMN estado
1553 - Cannot drop index 'state': needed in a Foreign key Constraint
set FOREIGN_KEY_CHECKS=0;
alter table pessoa drop estado
It was something I forgot to mention, but when I run this line:alter table person drop FOREIGN key status Gives the following error: #1091 - Can’t DROP 'status'; check that column/key exists But the column exists
– Ed Girão
What is the return when you execute the command: SHOW CREATE TABLE PERSON?
– escapistabr