Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Soft Delete Pattern

Medium Schema Design

Instead of physically deleting customers, mark them as deleted with a timestamp. Add the column, write the statement that 'deletes' customer 5 and create a view that exposes only customers that are not deleted.

Table schema

Customers(id INT PRIMARY KEY, name VARCHAR(50))

Sample data

Customer 5 is deleted but must stay in the table for auditing.

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.