Tutorials Hut

  • SQL Testing




  • SQL -Truncate Table Statement

    SQL TRUNCATE TABLE statement is used to delete all records from a table. 

      • It is same function as a DELETE statement without a WHERE clause.

    Syntax

    TRUNCATE TABLE table_name;

    Example

    Below is the Student Table.

    SQL Truncate Table 1

    Executing Truncate Command  

    mysql> TRUNCATE Student;
    Query OK, 0 rows affected (2.56 sec)

    Student Table is truncated  and below is the output of SELECT query

    mysql> Select * from Student;
    Empty set (0.00 sec)
      
    Recommended Articles:



  • SQL Testing


















  • Leave a Reply

    Your email address will not be published. Required fields are marked *