If you are accessing the database through the Data Explorer plugin, that plugin only allows read-only queries. It is not possible to use it to write to the database.
It is possible to fully delete posts from the Rails console, but we don’t recommend doing that. Your best approach would be to use the Data Explorer plugin to find the posts you want to delete, and then use the tools availale on the Discourse user interface to remove the posts.
If for some reason this approach won’t work for you, let us know and we can give you details about deleting posts from the Rails console.