How do I truncate table in MySQL?MySQL truncates the table by dropping and Alter, removes all rows

Опубликовано: 09 Апрель 2026
на канале: TECH SOFT
58
5

#truncate_table #DROP_TABLE #ALTER_TABLE
ALTER TABLE, DROP TABLE TRUNCATE TABLE


1:. The #ALTER TABLE statement is used to add, delete, or modify columns in an existing table. is also used to add and drop various constraints on an existing table.

2:. TRUNCATE TABLE table_name;

3:. The #DROP TABLE statement is used to drop an existing table in a database.

In SQL, the TRUNCATE TABLE statement is a Data Definition Language operation that marks the extents of a table for deallocation. The result of this operation quickly removes all data from a table, typically bypassing a number of integrity enforcing mechanisms.

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.
The basic syntax of a TRUNCATE TABLE command is as follows.

Consider a CUSTOMERS table having the following records −

.........................................................
ID |NAME | AGE | ADDRESS | SALARY
.............................................
1 | Ramesh | 32 | Hajipur |2000.00
2 | rakesh | 25 |patna |1500.00
4 | puja | 22 |Patna |6500.00
5 |indermani | 27 | muzaffrpur | 8500.00

..................................................

SQ : TRUNCATE TABLE CUSTOMERS;
SQL: SELECT * FROM CUSTOMERS;
Empty set (0.00 sec)


************************************

1. how to create table in mysql

   • How to create table in mysql with primary ...  

. 2:.how to create table in mysql with primary key

   • How to create table in mysql with primary ...