Truncate or delete all records in a custom object
You can't perform any DML using SOQL. The 'Q' stands for 'Query'.
If you want to use Execute Anonymous, then you can use:
delete [select id from myobject__c limit 10000];
However, this has a 10,000 row limit, so that might not be appropriate in all cases.
Salesforce can query 50,000 records at a time but due to governor limit it'll allow only 10,000 DML operation
The only way to perform a quick truncate would be to use the UI to initiate the truncate.