---
title: "What is Cascade in SQL?"  
description: "What is Cascade in SQL?"  
author: "Anubhav Sharma"  
published: 2026-01-27  
updated: 2026-01-28  
canonical: https://answers.mindstick.com/qa/116301/what-is-cascade-in-sql  
category: "database"  
tags: ["database", "sql server"]  
reading_time: 2 minutes  

---

# What is Cascade in SQL?

## Answers

### Answer by Ravi Vishwakarma

In SQL, **CASCADE** means **“automatically apply this action to related records”** when a change happens in a parent table.

It’s mainly used with **[foreign key constraints](https://www.mindstick.com/blog/11170/sql-constraints)**.

## Why CASCADE exists

[Databases](https://www.mindstick.com/startup/34/airbyte-the-open-source-platform-simplifying-data-integration-for-warehouses-lakes-and-databases) often have **parent–child [relationships](https://www.mindstick.com/blog/300112/how-mental-illness-affects-romantic-relationships)**.

## Example:

- `Users` (parent)
- `Orders` (child → references `Users.UserId`)
- CASCADE helps keep data **consistent** without [writing](https://www.mindstick.com/articles/23547/5-golden-rules-for-writing-excellent-college-papers) extra queries.

## Common CASCADE types

### 1. `ON DELETE CASCADE`

When a row in the **parent table is deleted**, all related rows in the **child table are deleted automatically**.

```plaintext
CREATE TABLE Orders (
    OrderId INT PRIMARY KEY,
    UserId INT,
    FOREIGN KEY (UserId)
        REFERENCES Users(UserId)
        ON DELETE CASCADE
);
```

What happens:

- Delete a user
- All their orders are deleted automatically

Good for:

- Logs
- History tables
- Dependent data that should not exist without the parent

### 2. `ON UPDATE CASCADE`

When the **parent key value changes**, the child table is updated automatically.

```plaintext
FOREIGN KEY (UserId)
REFERENCES Users(UserId)
ON UPDATE CASCADE
```

What happens:

- `Users.UserId` changes
- `Orders.UserId` updates automatically

Less common because:

- [Primary keys](https://www.mindstick.com/forum/156008/how-do-you-set-two-primary-keys-in-access) usually don’t change

## CASCADE vs other options

| Option | Behavior |
| --- | --- |
| `CASCADE` | Automatically updates/deletes child rows |
| `RESTRICT` / `NO ACTION` | Prevents delete/update if child rows exist |
| `SET NULL` | Sets child foreign key to `NULL` |
| `SET DEFAULT` | Sets child foreign key to [default value](https://www.mindstick.com/forum/1890/how-to-set-default-value-for-combobox) |

Example:

```plaintext
ON DELETE SET NULL
```

## Real-world example

```plaintext
DELETE FROM Users WHERE UserId = 10;
```

With `ON DELETE CASCADE`:

- User 10 → deleted
- Orders of User 10 → deleted automatically

Without CASCADE:

- Error: **Cannot delete because related records exist**

## Important cautions

- CASCADE can delete **[large amounts of data](https://www.mindstick.com/forum/161107/how-does-mongodb-handle-large-amounts-of-data-and-maintain-performance)** unintentionally
- Always understand relationships before using it
- Avoid CASCADE on **[critical](https://www.mindstick.com/blog/11954/using-an-email-verifier-a-critical-success-factor-in-email-marketing) [business](https://www.mindstick.com/articles/23272/why-software-localization-is-important-for-your-business) data** unless required

## Simple one-line definition

> **CASCADE in SQL automatically applies delete or update [operations](https://www.mindstick.com/blog/304985/how-does-devops-bridge-the-gap-between-development-and-operations-teams-like-git) from a parent table to its related child records.**


---

Original Source: https://answers.mindstick.com/qa/116301/what-is-cascade-in-sql

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
