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.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.