How to run Custom Query in Magento ?

Check out the below code.

To avoid capitulating to essay writing service these conventionenforcing,