DROP TABLE IF EXISTS referred, refer;
CREATE TABLE referred (
id int PRIMARY KEY AUTO_INCREMENT
);
CREATE TABLE refer (
id int PRIMARY KEY AUTO_INCREMENT,
id_referred int NOT NULL,
CONSTRAINT id_referred FOREIGN KEY (id_referred) REFERENCES referred (id)
);
DROP TABLE referred;
ERROR HY000: Cannot drop table 'referred' referenced by a foreign key constraint 'id_referred' on table 'refer'.
DROP TABLE refer;
DROP TABLE referred;
