All Questions
Tagged with delete database-design
14 questions
0
votes
1
answer
82
views
SQL Server: How to implement 3-way relationship with cascades
This is the schema I'm working with:
Here's the DBML to recreate in https://dbdiagram.io/d:
Table University {
ID integer [primary key]
}
Table Professor {
ID integer [primary key]
...
0
votes
1
answer
38
views
How to handle the deletion of records with "shared ownership"?
Consider the following scenario:
In a trading card game, a user may offer to trade their cards. The offer can be public (any user can accept, fk_receiver_id null on insert) or private (only one user ...
1
vote
1
answer
809
views
Adding soft delete to a database after having used hard delete
Introduction
My app collects data from a centralized source where many different users can submit data about their organisation and their staff.
Previously we used to just hard delete a users data ...
0
votes
2
answers
76
views
Create a DELETE statement that deletes Models that haven’t had a purchase since December 31st 2014
We are given 5 tables.
Orders
Order number (Primary Key)
Date of order
Customer ID (Primary Key for Customers table)
Serial Number (Primary Key for Machines table)
Customers
ID ...
0
votes
1
answer
44
views
Delete all data for a Single Vendor in the Dabatase
I have a Vendor table with vendor_Id as the PK and 10 other tables which have reference to Vendor.vendor_Id.
Now, if Vendor chooses to close their account, we need to delete all the data in the other ...
0
votes
1
answer
64
views
Delete comment - actually delete it, or create `deleted` column and update it?
I'm really not sure if this is the right community to ask it in, but it seemed like it fits here.
But anyway, I'd like to know what's the usual approach of deleting a comment from database through ...
-1
votes
1
answer
48
views
Storing User Information after Deletion
I am building a collaboration platform that focuses on being a knowledge base for teams and a big part of creating a knowledge base is storing historical information even when an employee has left. ...
21
votes
3
answers
144k
views
MySQL - Delete row that has a foreign key constraint which reference to itself
I have a table in which I store all the forum messages posted by the users on my website. The messages hierarchy strucrue is implement using a Nested set model.
The following is a simplified ...
3
votes
1
answer
11k
views
Cascade deletes from multiple tables
I have a fairly standard restaurant model with a restaurant table in a PostgreSQL DB. All restaurants have ratings (which consist of average, vote_count and vote_sum) but in order to avoid repeating ...
6
votes
1
answer
4k
views
Hard delete vs soft delete performance
I've got this table that is intended to have a lot of activity. Anything that's in it indicates that a user action is still pending. Once deleted, it would indicate that action is no longer pending. ...
2
votes
1
answer
3k
views
Soft delete to improve performance: all wrong?
A few years back I read soft delete would improve performance of deletion, because instead of actually removing the item and impact the clustered (and all other) indices, it would just change a value.
...
0
votes
1
answer
50
views
Is it possible (or good practice) to register data upon Deletion of a record? What would be a better solution?
The problem is the following.
A company has one or more representatives (a person who speaks on behalf of the company).
When a representative is deleted, it's desired to keep it in an list called "...
7
votes
2
answers
7k
views
How to implement soft deletes?
What is your method of implementing soft deletes in a database?
Ideally the solution would allow for
decent performance on large tables
take relationships into account
take unique keys into account
...
46
votes
9
answers
12k
views
How should deletions be handled in the database?
I'd like to implement an "undelete" feature in a web application such that a user can change her mind and recover a deleted record. Thoughts on how to implement this? Some options I've considered are ...