About 1,140,000 results
Open links in new tab
  1. Delete, Truncate or Drop to clean out a table in MySQL

    Nov 10, 2014 · Truncate is similar to delete; however, it resets the auto_increment counter back to 1 (or the initial starting value). However, it's better to use truncate over delete because delete removes the …

  2. Truncate multiple tables with one SQL statement

    May 17, 2024 · No, you can only truncate a single table with TRUNCATE command. To truncate multiple tables you can use T-SQL and iterate through table names to truncate each at a time.

  3. sql - Truncate with condition - Stack Overflow

    Oct 3, 2010 · The short answer is no: MySQL does not allow you to add a WHERE clause to the TRUNCATE statement. Here's MySQL's documentation about the TRUNCATE statement. But the …

  4. Truncate all tables in a MySQL database in one command?

    Dec 16, 2009 · Is there a query (command) to truncate all the tables in a database in one operation? I want to know if I can do this with one single query.

  5. mysql - How do I truncate tables properly? - Stack Overflow

    Dec 27, 2011 · You should truncate child tables firstly, then parent tables. Disabling foreign key checks risks entering rows into your tables that don't adhere to the constraints which can cause undefined …

  6. Clear data in MySQL table with PHP? - Stack Overflow

    Apr 7, 2009 · How do I clear all the entries from just one table in MySQL with PHP?

  7. mysql - How to truncate a foreign key constrained table ... - Stack ...

    Why doesn't a TRUNCATE on mygroup work? Even though I have ON DELETE CASCADE SET I get: ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint …

  8. How to reset AUTO_INCREMENT in MySQL - Stack Overflow

    Jan 19, 2012 · How can I reset the AUTO_INCREMENT of a field? I want it to start counting from 1 again.

  9. TRUNCATE data from all tables in a Database - Stack Overflow

    Apr 3, 2017 · 6 For some work, the requirement is such that we want to retain the table and database structure while truncating all data in the multiple table at one go. Since Truncate Table_name only …

  10. Difference between drop table and truncate table? - Stack Overflow

    Sep 25, 2008 · If you truncate the table, MySQL doesn't free the space of the hard disk. If you want your storage back, you should drop the table without truncating it.