SQL tutorials 20: On Delete Cascade Foreign Key By Manish Sharma (RebellionRider)
Key Takeaways
Defines a foreign key with an ON DELETE CASCADE clause in SQL
Full Transcript
What's up internet? This is Manish from rebellionrider.com and today in this SQL tutorial we will learn about ondee casket clause of foreign key. But before that I'll suggest you to watch my previous video on foreign key and ondeel to have better understanding of this concept. You can also visit my website to read about onde cascade close link is in the description below. You can also download the SQL script which we will be going to create in this tutorial. Link is right here. I shared all my resources used in this tutorial using copy cloud. CopyCloud gives 15 GB of free cloud storage on joining but you can earn extra 5GB by using my referral link means you can get total 20 GB of free cloud storage. Pretty great, isn't it? To get extra 5GB, you just have to use my referral link which is in the description below to sign up. Then just verify your email address and download copy cloud on your desktop or laptop and you will receive 20 GB instantly. Okay, let's jump over SQL development. Now again we will be using parent table authors and child table books. Parent table author has two columns author ID and author name where author ID column is primary key. I have already inserted some data into this table to demonstrate on delete cascade clause. As this is a simple table with primary key, you can watch my SQL tutorial 17 on how to define primary key. And child table book has three column. Book ID, book title and book author ID. Book author ID is our foreign key column. For this tutorial, let's recreate the child table with ondee cascade clause of foreign key. So let's create the child table box. book call3_FK is a userdefined constraint name. You can give whatever you want. I just specify BK for table name books. Call three for uh column three as we are defining our foreign key over column three book author ID and FK is for foreign key as we have to define ondee casket clause on our foreign key. So we have to specify ondee casket right here. As column 3 book author ID is referenced from author ID column of table authors. Therefore, it must have the same data type and column width as of author ID column of author table. Execute table books created. Now we have to insert some data. As you can see, I'm going to insert five rows in our book table. Select them all and execute them all. We have five rows. Let's check. Here is our book table. Here is our book table with three column book ID, book title, book author ID, and uh data. We have five rows here as you can see. 1 2 3 4 5. Now let's check since we have foreign key with ondee cascade clause on child table books. Therefore it means that if we delete a row from a parent table authors then the corresponding value to that row in the child table will get deleted automatically. That is the purpose of ondee casket clause. So let's delete first row of parent table authors where we have author ID 1. Let me show you. Here is our author table and we are going to delete this table uh sorry row one where we have author ID one and author name Bob. Let's adjust this SQL developer. So let's delete this row from parent table and see what happen with the corresponding row in child table. So let's have our child table here. This is our child table. And now let's delete row one from author table. For that just write delete. Okay. Execute. One row deleted. Okay. First row is deleted from author table. Let's refresh the data of child table. Here you can see we have five rows. Now let's refresh. There we go. Two rows, row one and row five are deleted automatically. That's what ondee cascade clause does. Hope you learned something. You can visit my website to read more about ondelete casket here. You can find the link in the description below. Help me spreading the word by sharing my video with your friends on your social media. That's it for today. We will see you soon with another SQL tutorial. Till then, take care. This is Manish. Oh yeah, one more thing. Don't forget to like and subscribe. Thanks.
Original Description
Oracle Database 11g Tutorial 20: On delete cascade
This tutorial will show you how to define foreign key with on delete cascade clause.
Links
Blog: http://www.rebellionrider.com/on-delete-cascade.htm
SQL Tutorial 19 On delete set Null: http://www.rebellionrider.com/on-delete-cascade.htm
SQL Tutorial 19 Foreign Key:
http://youtu.be/0nbkBI5r3Gw
Copy Cloud referral link || Use this link to join copy cloud and get 20GB of free storage
https://copy.com?r=j7eYO7
Tool used in this tutorial is SQL Developer.
This tutorial series is part of SQL expert exam certification training. if you are preparing for SQL certification you can use my tutorials. This SQL Tutorial is a part of free training.
Contacts
E-Mail
RebellionRiderYT@gmail.com
Twitter
https://twitter.com/rebellionrider
Instagram
http://instagram.com/rebellionrider
Facebook.
https://www.facebook.com/imthebhardwaj
Linkedin.
http://in.linkedin.com/in/mannbhardwaj/
Thanks for liking, commenting, sharing and watching more of our videos
This is Manish from RebellionRider.com
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Manish Sharma · Manish Sharma · 25 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
▶
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Oracle Database tutorials 1: How to install Oracle Database 11g on windows 7
Manish Sharma
Oracle Database tutorials 2:How To install SQL Developer on windows 7
Manish Sharma
Oracle Database tutorials 3:How to enable Line numbers in SQL Developer.
Manish Sharma
Oracle Database tutorials 4: database connectivity using SQL developer and command prompt
Manish Sharma
Oracle Database tutorials 5: how to Fetch Data using SELECT - SQL statement by Manish Sharma
Manish Sharma
Oracle Database11g tutorials 6 | | How to use Concatenation operator, character String
Manish Sharma
Oracle Database11g tutorials 7 | |SQL DISTINCT keyword || SQL tutorials
Manish Sharma
Canon EOS 600D 2 lens kit/Canon rebell EOS T3i 2 lens kit Unboxing
Manish Sharma
First look: ORACLE CERTIFIED ASSOCIATE (OCA) CERTIFICATE - ORACLE DATABASE ADMINISTRATOR
Manish Sharma
Oracle Database11g tutorials 8 || SQL DISTINCT with multiple columns |SQL Distinct with Two columns
Manish Sharma
Oracle Database11g tutorials 9 || What is archive log mode and how to enable archive log mode
Manish Sharma
Oracle Database11g tutorials 10 || SQL Single Row Function (SQL Functions )
Manish Sharma
Oracle Database11g tutorials 11: SQL case manipulation function in Oracle Database
Manish Sharma
how to add channel trailer and section on your youtube channel 2014
Manish Sharma
Oracle Database11g tutorials 12 || SQL Concat Function - SQL character manipulation function
Manish Sharma
Oracle Database11g tutorials 13 || SQL substr function / SQL substring function
Manish Sharma
Oracle Database11g tutorials 14 : How to CREATE TABLE using sql developer and command prompt
Manish Sharma
SQL tutorials 15 || How To CREATE TABLE using enterprise manager 11g
Manish Sharma
Oracle Database11g tutorials 16: How to uninstall oracle 11g from windows 7 64 bit
Manish Sharma
ORACLE CERTIFIED PROFESSIONAL(OCP) CERTIFICATE First look - ORACLE DATABASE ADMINISTRATOR
Manish Sharma
Plantronics audio 655 USB headset with Mic Unboxing and Review and Plantronics audio 655 Mic test
Manish Sharma
SQL tutorials 17: SQL Primary Key constraint, Drop primary Key
Manish Sharma
SQL tutorials 18: SQL Foreign Key Constraint By Manish Sharma
Manish Sharma
SQL tutorial 19: ON DELETE SET NULL clause of Foreign Key By Manish Sharma (RebellionRider)
Manish Sharma
SQL tutorials 20: On Delete Cascade Foreign Key By Manish Sharma (RebellionRider)
Manish Sharma
SQL tutorial 21: How To Rename Table in SQL using ALTER TABLE statement By Manish Sharma
Manish Sharma
SQL tutorial 22: How to Add / Delete column from an existing table using alter table
Manish Sharma
SQL tutorial 23: Rename and Modify Column Using Alter Table By Manish Sharma (RebellionRider)
Manish Sharma
SQL tutorial 24 :SQLJoins- Natural Join With ON and USING clause By Manish/Rebellionrider
Manish Sharma
Oracle Database11g tutorials 25: How to install Oracle Database 11g Express Edition R2 on Windows 7
Manish Sharma
SQL tutorial 26: Introduction to SQL Joins in Oracle Database
Manish Sharma
Vidcon 2014 YouTube Fan Funding: How to enable fan funding on YouTube Channel
Manish Sharma
SQL tutorial 27: Right Outer Join in SQL by Manish Sharma for RebellionRider
Manish Sharma
SQL tutorial 28: Left Outer Join By Manish Sharma / RebellionRider
Manish Sharma
SQL tutorial 29: Full Outer Join with example By Manish Sharma/ RebellionRider
Manish Sharma
SQL tutorial 30: Inner Join In SQL by Manish Sharma/RebellionRider
Manish Sharma
SQL tutorial 31 : SQL Cross Join In Oracle Database By Manish Sharma from RebellionRider
Manish Sharma
SQL tutorial 32: How To Insert Data into a Table Using SQL Developer
Manish Sharma
SQL tutorial 33:How To Insert Data into a Table Using SQL INSERT INTO dml statement
Manish Sharma
SQL tutorial 34: How to copy /Insert data into a table from another table using INSERT INTO SELECT
Manish Sharma
SQL tutorial 35: DELETE and TRUNCATE how to delete data from a table
Manish Sharma
SQL tutorial 36: how to create database using database configuration assistant DBCA
Manish Sharma
SQL tutorial 37: How to create NEW USER account using Create User statement in Oracle database
Manish Sharma
SQL tutorial 38: How to create user using SQL Developer in Oracle database
Manish Sharma
SQL tutorial 39: How to create user in oracle using Enterprise Manager
Manish Sharma
SQL tutorial 40: DBA Trick, How to drop a user when it is connected to the database
Manish Sharma
Motorola Moto G 2nd Generation / G2 Unboxing and Review
Manish Sharma
SQL tutorial 41: How to UNLOCK USER in oracle Database
Manish Sharma
SQL tutorial 42: How to Unlock user using SQL Developer By Manish Sharma RebellionRider
Manish Sharma
SQL tutorial 43: How to create an EXTERNAL USER in oracle database By Manish Sharma RebellionRider
Manish Sharma
SQL tutorial 44: How to import data from Microsoft Excel to Oracle Database using SQL Developer
Manish Sharma
SQL tutorial 45: Introduction to user Privileges in Oracle Database By Manish Sharma RebellionRider
Manish Sharma
SQL tutorial 46: What are System Privileges & How To Grant them using Data Control Language
Manish Sharma
SQL tutorial 47: How to Grant Object Privileges With Grant Option in Oracle Database
Manish Sharma
SQL tutorial 48: How to create Roles in Oracle Database
Manish Sharma
SQL tutorial 49: CASE - Simple Case Expression in Oracle Database (1/2)
Manish Sharma
SQL tutorial 50: CASE - Searched Case Expression In Oracle (2/2)
Manish Sharma
SQL tutorial 51: DECODE function in Oracle Database By Manish Sharma (RebellionRider)
Manish Sharma
Oracle Database Tutorial 52 : Data Pump expdp - How to Export full database using expdp
Manish Sharma
Oracle Database Tutorial 53 : Data pump expdp - How to Export tablespace in Oracle Database
Manish Sharma
More on: SQL Analytics
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
The HiPPO is always right
Dev.to · Sharmin Sirajudeen
How to Extract Saudi Arabia Property Data Across Bayut.sa, Wasalt.sa, Aqar.fm and PropertyFinder.sa
Dev.to · Omar Eldeeb
Norway vs France (1:4) — A 97% Crime Index Anomaly: When Ruthless Efficiency Buries the xG Evidence
Medium · Data Science
How to Build an H-1B Salary Database by Employer (the Real Data Source + Python)
Dev.to · Omar Eldeeb
🎓
Tutor Explanation
DeepCamp AI