|
Home >> FAQs/Tutorials >> MySQL Tutorials >> Index
MySQL FAQs - Understanding SQL INSERT, UPDATE and DELETE Statements
By: FYIcenter.com
Part:
1
2
3
4
5
6
7
(Continued from previous part...)
How To Delete All Rows a Table?
If you want to delete all rows from a table, you have two options:
- Use the DELETE statement with no WHERE clause.
- Use the TRUNCATE TABLE statement.
The TRUNCATE statement is more efficient the DELETE statement.
The tutorial exercise shows you a good example of TRUNCATE statement:
mysql> SELECT COUNT(*) FROM fyi_links;
+----------+
| COUNT(*) |
+----------+
| 5 |
+----------+
1 row in set (0.08 sec)
mysql> TRUNCATE TABLE fyi_links;
Query OK, 0 rows affected (0.02 sec)
mysql> SELECT COUNT(*) FROM fyi_links;
+----------+
| COUNT(*) |
+----------+
| 0 |
+----------+
1 row in set (0.00 sec)
Part:
1
2
3
4
5
6
7
|