If you remove all your raws, you might as well delete everything from the database, as it holds references to those files.
You can reset the collections filters so all images are visible, select all, delete. That cleans up the DB and deletes raws (and JPGs etc, whatever your input is) and XMPs. If you only want to delete raws, add a filter for the file format.
Wouldn’t it be simpler in that case to remove the database file (library.db) and re-import all images?
Deleting the images from a collection does not necessarily clean up the database (it can just mark the records concerned as deleted).
I assume that when we say “delete”, it means “removing images from darktable”, and not “delete files from the hard drive”… You may want to keep xmp files, as they contain the edits for the corresponding raw file, and will be re-imported with those raw files.
The “best” action here will depend on how exactly things are “messed up”, (and on who suggests said “best action” :P).
Have a good read about collections in the manual. You may not have messed up as much as you feel. There are many ways of looking at or creating collections depending on what best suits you.