MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following query if run will Truncate the DataFlair table?
A
TRUNCATE DataFlair;
B
TRUNCATE TABLE DataFlair;
C
TRUNCATE TABLE;
D
None of these
Explanation: 

Detailed explanation-1: -The SQL TRUNCATE TABLE command is used to delete complete data from an existing table. You can also use DROP TABLE command to delete complete table but it would remove complete table structure form the database and you would need to re-create this table once again if you wish you store some data.

Detailed explanation-2: -To remove all data from an existing table, use the SQL TRUNCATE TABLE order. You can also use the DROP TABLE command to delete an entire table. But Truncate will remove the entire table structure from the database, and you will need to recreate the table if you want to store any data.

Detailed explanation-3: -TRUNCATE TABLE removes all rows from a table, but the table structure and its columns, constraints, indexes, and so on remain. To remove the table definition in addition to its data, use the DROP TABLE statement.

Detailed explanation-4: -Answer: A. Explanation: The TRUNCATE statement in SQL removes all data from the table and free the table’s space. SQL’s DELETE statement removes all data from the table but does not free the table’s space.

There is 1 question to complete.