Delete : It comes under Data Manipulation Language(DML). This command is used for deleting all rows of the table, by using Delete command we can delete also a specific row.
For example: Delete the details of the student where id=212 from student table.
SQL COMMAND : Delete from Student Where id=212;
In this case only the details of student whose id=212 will be deleted.
If we use the command Delete from Student; Then the whole rows will be deleted. In this the whole data is in recycle bin .We can gain or access it again after rollback command . By using the delete command only data is deleted.
Drop : It comes under Data Definition Language (DDL). In this after using Drop command the data as well as the schema is deleted.
After command : DESC TABLE NAME ; Nothing is there neither the data nor schema.
Example : Drop table table name ; the all details as well as schema( structure of table) will be deleted.
Truncate : This command is used as Data Definition Language (DDL). This command is also used for deleting the rows. but in this all rows will be deleted at a time. ROLLBACK is not possible in this. The data is not stored in log or recycle bin , so we can't access it again.
Nice good explanation
ReplyDelete