6

How to destroy all table data:

* Get a database;
* Add the first table;
* Add the second table;
* Create a foreign key in second table that delete a record where there is a delete in the first table;
* Update all data in the first table with a REPLACE command.

Miracle: all data is lost

Comments
  • 3
    This is why recursive functions in databases should be outlawed unless you have a real DBA.
  • 3
    Why not "update"?
  • 4
    I used to work (briefly) at a place who had no foreign keys because they "tried but it caused too many problems". Pretty sure at some point they did something like this
  • 0
    @iiii Update was not used because the record could be already present
  • 0
    @PeterDCarter The is the point of view of the developer of this application. Now it has retired and I maintain the code. I tried to introduce some foreign key ... Bay try
Add Comment