Rows are not deleted from the tables named in the FROM clause...

The question is "Rows are not deleted from the tables named in the FROM clause of the DELETE statement" ?

The answer is Yes and No

NO ?
Normally, when we use DELETE statement on Independent table, The records will be deleted from the tables named in the FROM clause.

DELETE FROM TB_Items WHERE CategoryID = 1

But, we can also use the script without FROM clause here...

YES ?
when we use DELETE statement on dependent table, The records has to be deleted from the table1 which dependent on table2.

Basically, when we perform a DELETE operation on a table, The records will be removed from the table named in "FROM CLAUSE as given below".


But, What the image shows below is "Different"


When we perform DELETE operation on a table which is based on some other table then, The record will be removed from the table named nearby the DELETE statement, Not from the "FROM CLAUSE".

No comments:

Post a Comment