DELETE Statement:
- The DELETE statement is used to remove one or more specific rows from a table based on a specified condition or criteria. It's a Data Manipulation Language (DML) command.
- DELETE is typically used to delete specific data while keeping the table structure intact.
- It is slower than TRUNCATE for large tables, as it logs individual row deletions.
DROP Statement:
- The DROP statement is used to delete an entire database object, such as a table, view, or index. It's a Data Definition Language (DDL) command.
- DROP removes the entire object, including all its data, and the structure is deleted from the database.
- It should be used with caution, as it's irreversible and can result in data loss.
TRUNCATE Statement:
- The TRUNCATE statement is used to quickly delete all rows from a table, effectively emptying the table, but keeping its structure intact.
- TRUNCATE is typically faster than DELETE, especially for large tables, as it doesn't log individual row deletions.
- It's also a DDL command and cannot be used if the table is referenced by a foreign key.
Explanation with Illustrative examples covered in the Video.
0 Comments