IT Questions and Answers :)

Monday, November 26, 2018

In SQL, what is the effect of the TRUNCATE TABLE statement?

In SQL, what is the effect of the TRUNCATE TABLE statement?

  • To delete all of the rows contained within a table
  • To drop all of the tables in a database
  • To shorten all textual values in a column to a specified number of characters
  • To drop all of the columns defined on a table 

 
In SQL, what is the effect of the TRUNCATE TABLE statement?

EXPLANATION

TRUNCATE TABLE table-name;
 
TRUNCATE removes all of the rows from the specified table without logging the individual row deletions, without scanning the table, and makes freed disk space available to the operating system immediately, without requiring a subsequent VACUUM operation.
TRUNCATE TABLE is similar to a DELETE statement with no WHERE clause, which also removes all of the rows from a table; however, TRUNCATE is faster and uses fewer resources. TRUNCATE is most useful when working with very large tables where an unqualified DELETE could adversely affect database performance.

Share:

0 comments:

Post a Comment

Popular Posts