Which of the following SQL statements will remove all rows from the table T1? (Choose two.)
Which of the following SQL statements will remove all rows from the table T1? (Choose two.)
To remove all rows from a table in SQL, you can use either the DELETE statement or the TRUNCATE statement. The correct SQL syntax for these operations would be 'DELETE FROM t1' and 'TRUNCATE TABLE t1'. The DELETE statement removes all rows from the table but logs each row deletion individually, which can be slower for large tables. The TRUNCATE statement, on the other hand, is more efficient as it does not log individual row deletions and instead logs the deallocation of the table's data pages. Therefore, the correct answers are using 'DELETE FROM t1' and 'TRUNCATE TABLE t1'.
The syntax of the query "DELETE * FROM t1" is not correct in Db2. The correct answers are : "A- DELETE FROM t1" "C- TRUNCATE TABLE t1 IMMEDIATE"
A and D [db2inst2@vbox1 ~]$ db2 delete from sample; DB20000I The SQL command completed successfully. [db2inst2@vbox1 ~]$ db2 truncate table sample immediate DB20000I The SQL command completed successfully. Tested and verified.