MCQ IN COMPUTER SCIENCE & ENGINEERING

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)
A
DELETE FROM table ____ name;
B
DELETE TABLE table ____ name;
C
DROP TABLE table ____ name;
D
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.