Site admins often want to remove test orders from the DB before going live.
Rows will need to be removed from 4 tables to completely remove the test orders. The following SQL statements will clear those orders out. Make sure you have a good backup of your database before making changes to it.
1. Go to Configuration → Advanced → Run SQL.

2. Type the following commands and click Submit. Make sure to replace 'lastordernumbertokeep' with the number you want to use.
DELETE FROM Orders WHERE OrderNumber < lastordernumbertokeep
DELETE FROM Orders_CustomCart WHERE OrderNumber < lastordernumbertokeep
DELETE FROM Orders_KitCart WHERE OrderNumber < lastordernumbertokeep
DELETE FROM Orders_ShoppingCart WHERE OrderNumber < lastordernumbertokeep
Note: These statements assume that you want to remove ALL orders before "lastordernumbertokeep." If that is not the case, you may need to edit these statements.