seyed hossein abtahi
seyed hossein abtahi

Reputation: 53

May be Lock one record(row) in database (MySql)?

i have some records in my database and i want to lock them from delete action! does exist any way to lock them? i need Query for SQL (My Sql)

Upvotes: 0

Views: 39

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269933

Here are two methods:

  1. Add a delete trigger on the table to prevent certain rows from being deleted.
  2. Maintain a separate table of "do not delete" records and define a foreign key constraint to the records you want to keep.

Upvotes: 2

Related Questions