How can we uninstall a module directly from the database?
You can use 


drush pm-uninstall.
If you have entities in your module, write a query in your module to first delete all entities of your particular entity type. Once deleted, remove that file where you have written annotation for your entity, create a backup for use later. Except .info.yml file and .install file, remove all files.


Now you can easily un-install that module. Once un-installed, put all your backed up files into your module folder again, install your module and go!