check_circleMark as learned
Temporarily disabling a foreign key constraint in MySQL
schedule Mar 5, 2023Last updated
tocTable of Contentsexpand_more
Check out the interactive map of data science
We can temporarily disable foreign key constraints on a session level in MySQL by using the below:
SET FOREIGN_KEY_CHECKS = 0;
However, make sure to restore the foreign key constraints once you are finished:
SET FOREIGN_KEY_CHECKS = 1;
MySQL | Foreign keys
A foreign key in MySQL refers to a column (or a group of columns) in one table that refers to the primary key in another table. The table containing the foreign key is referred to as the child table, while the table containing the primary key being referred to is called the parent table.
Published by Arthur Yanagisawa
Edited by 0 others
Did you find this page useful?
Ask a question or leave a feedback...
Enjoy our search
Hit / to insta-search docs and recipes!