MySQL: ON DELETE

preview_player
Показать описание
#MySQL #tutorial #course

00:00:00 intro
00:02:24 SET NULL
00:04:40 CASCADE
00:07:11 conclusion

ALTER TABLE transactions
ADD CONSTRAINT fk_customer_id
FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
ON DELETE SET NULL;

ALTER TABLE transactions
ADD CONSTRAINT fk_customer_id
FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
ON DELETE CASCADE;
Рекомендации по теме
Комментарии
Автор

ALTER TABLE transactions
ADD CONSTRAINT fk_customer_id
FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
ON DELETE SET NULL;

ALTER TABLE transactions
ADD CONSTRAINT fk_customer_id
FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
ON DELETE CASCADE;

BroCodez
Автор

Bro you made everything so easy peasy to understand. Love you

contactdi
Автор

thank you for you incredible work bro i luv u

massivestrokeee_
Автор

I love how you explain things in the simplest way.
Perfectly understandable.
Many thanks man.

navidrahbar-musicproducers
Автор

Hey Bro, could you please create java spring boot tutorial.

BenisNostalgic
Автор

question, if the data that has the foreign key is not nullable, does the on delete set null still work?

acminostgien
Автор

could you please do full PHP course bro?

nicolewynne
Автор

Hi bro, I am following your whole SQL series and I have learnt all the concepts but this ON DELETE concept sucks. I typed the same query as you have shown but still it gives me error "Error Code: 1451. Cannot delete or update a parent row: a foreign key constraint fails (`mydb`.`transactions`, CONSTRAINT `transactions_ibfk_1` FOREIGN KEY (`c_id`) REFERENCES `customers` (`c_id`))". Can you please help me with this @BroCode .

_sumedh_music
Автор

i dont know bro what is your obsession with poppy puff

funnyoceanofmemes