TRUNCATE TABLE in MariaDB

TRUNCATE TABLE To delete all records of a table such that the table cannot be rolled back, the MariaDB TRUNCATE TABLE statement is used. It is much similar to the DELETE TABLE statement without a WHERE clause.

Syntax:

TRUNCATE TABLE database_name.table_name   

Parameters: database_name: It is used to specify the name of the database to select. table_name: It is used to specify the name of the table to be truncated.

Example:

TRUNCATE TABLE celebrities.players;

Explanation: In the above example we are deleting all the records of the ‘players’ table which is an already existing table in the ‘celebrities’ database. Check the table using the SELECT statement. SELECT* FROM players;

Please follow and like us:
Content Protection by DMCA.com