
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we delete all rows from a MySQL table?
We can use either TRUNCATE statement or DROP statement to delete all the rows from the table. It can also be done with the help of DELETE statement but in that case WHERE clause must identify all the rows of the table. As we know that both TRUNCATE and DELETE statement will not delete the structure of the table but still it is better to use TRUNCATE statement rather than DELETE statement. DROP statement will delete table’s structure also.
Syntax
TRUNCATE statement
TRUNCATE table table_name:
Syntax
DROP statement
DROP table table_name:
- Related Articles
- How can we delete multiple rows from a MySQL table?
- How can we delete a single row from a MySQL table?
- Delete all records from a table in MySQL?
- Delete all the records from a MySQL table?
- How can we use MySQL TRIM() to remove the whitespaces from all the rows and update table?
- How can we fetch all the records from a particular MySQL table?
- MySQL: delete all rows containing string “foo” in sample table “bar”?
- How can we export all the data from MySQL table into a text file?
- How can we export all the data from MySQL table into a CSV file?
- How can I loop through all rows of a table in MySQL?
- How can we delete a MySQL stored function from the database?
- How can we remove a column from MySQL table?
- How can you delete a table from a database in MySQL Python?
- Delete more than one rows from a table using id in MySQL?
- Delete only some rows from a table based on a condition in MySQL

Advertisements