Search code examples
sqldatabaseoracle-databasesql-deletesql-drop

Understanding DELETE and DROP command


I am a student of Computer Science. Recently I am trying to learn database. I found a link describing about the difference between DELETE and DROP command. I understand most of the difference between them with the most important one - DELETE removes only data where DROP removes the table/object too.

But I can not understand one difference - DELETE command fire a DML trigger where DROP doesn't fire any DML trigger. The link only state this fact without any explanation. Can someone explain it a bit, so that I can understand it more.


Solution

  • "DELETE command fire a DML trigger where DROP doesn't fire any DML trigger"'

    In Oracle & some other DB provides triggers. Triggers are noting but subroutines which will get executed on DML actions like INSERT, UPDATE, DELETE .. say on updating some row in a table, a trigger can be invoked.

    Similarly when you execute delete statement, a trigger can be executed. To get more understanding read through triggers.