sql - MySQL ON DELETE CASCADE -


i have been working on mysql past few months. kindly apologize if question silly.

we have foreign key checks,

enable - set @old_foreign_key_checks=@@foreign_key_checks,foreign_key_checks=1;

disable - set @old_foreign_key_checks=@@foreign_key_checks,foreign_key_checks=0;

similarly,

do have query enable , disable on delete cascade in mysql?

thanks.

create new foreign key constraint using :

create table table_name (   column1 datatype null/not null,   column2 datatype null/not null,   ...    constraint fk_column      foreign key (column1, column2, ... column_n)      references parent_table (column1, column2, ... column_n)      on delete cascade ); 

or alter existing constraint:

alter table table_name add constraint constraint_name    foreign key (column1, column2, ... column_n)    references parent_table (column1, column2, ... column_n)    on delete cascade; 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -