COMPUTER SCIENCE AND ENGINEERING
SQL
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
SQL Query to delete all rows in a table without deleting the table (structure, attributes, and indexes)
|
DELETE FROM table ____ name;
|
|
DELETE TABLE table ____ name;
|
|
DROP TABLE table ____ name;
|
|
None
|
Explanation:
Detailed explanation-1: -The TRUNCATE TABLE statement removes all the rows from a table, but the table structure and its columns, constraints, indexes, and so on remain intact.
Detailed explanation-2: -just use a delete command with no WHERE clause (for a SQL database). It will remove all the rows but leave the table structure including indexes intact.
Detailed explanation-3: -TRUNCATE TABLE is similar to DELETE, but this operation is a DDL (Data Definition Language) command. It also deletes records from a table without removing table structure, but it doesn’t use the WHERE clause.
There is 1 question to complete.