CREATE TABLE Statement Adding and dropping a foreign key in the same  ALTER TABLE  statement is supported for  ALTER TABLE ... ALGORITHM=INPLACE . It is not supported for  ALTER TABLE ... ALGORITHM=COPY . Foreign key checking is controlled by the  foreign_key_checks  variable, which is enabled by default. Typically, you leave this variable enabled during normal operation to enforce referential integrity. The foreign_key_checks  variable has the same effect on  NDB  tables as it does for  InnoDB  tables. The  foreign_key_checks  variable is dynamic and supports both global and session scopes. For information about using system variables, see Section 5.1.9, “Using System Variables” . Disabling foreign key checking is useful when: When  foreign_key_checks  is disabled, foreign key constraints are ignored, with the following exceptions: Disabling  foreign_key_checks  has these additional implications: •Dropping a table that is referenced by a foreign key constraint. A referenced table can only be dropped after  foreign_key_checks  is disabled. When you drop a table, constraints defined on the table are also dropped. •Reloading tables in different order than required by their foreign key relationships. For example, mysqldump  produces correct definitions of tables in the dump file, including foreign key constraints for child tables. To make it easier to reload dump files for tables with foreign key relationships,  mysqldump automatically includes a statement in the dump output that disables  foreign_key_checks . This enables you to import the tables in any order in case the dump file contains tables that are not correctly ordered for foreign keys. Disabling  foreign_key_checks  also speeds up the import operation by avoiding foreign key checks. •Executing  LOAD DATA  operations, to avoid foreign key checking. •Performing an  ALTER TABLE  operation on a table that has a foreign key relationship. •Recreating a table that was previously dropped returns an error if the table definition does not conform to the foreign key constraints that reference the table. The table must have the correct column names and types. It must also have indexes on the referenced keys. If these requirements are not satisfied, MySQL returns Error 1005 that refers to errno: 150 in the error message, which means that a foreign key constraint was not correctly formed. •Altering a table returns an error (errno: 150) if a foreign key definition is incorrectly formed for the altered table. •Dropping an index required by a foreign key constraint. The foreign key constraint must be removed before dropping the index. •Creating a foreign key constraint where a column references a nonmatching column type. •It is permitted to drop a database that contains tables with foreign keys that are referenced by tables outside the database. 2579 Foreign Key Checks KEY ‘par_ind‘ (‘parent_id‘), CONSTRAINT ‘child_ibfk_1‘ FOREIGN KEY (‘parent_id‘) REFERENCES ‘parent‘ (‘id‘) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci mysql>  ALTER TABLE child DROP FOREIGN KEY ‘child_ibfk_1‘;