Which SQL command removes all rows from a table while retaining its structure?
Options
-
A.
DROP TABLE
-
B.
TRUNCATE TABLE
-
C.
ALTER TABLE
-
D.
More than one of the above
-
E.
None of the above
Correct Answer (Detailed Explanation is Below)
B.
TRUNCATE TABLE
Detailed Explanation
- TRUNCATE TABLE: Removes all rows from a table while retaining its table definition.
- It does not use a WHERE clause.
- Its rollback and identity-reset behavior depends on the DBMS.
OOps! You are currently offline.