How to download Database results as PDF or in EXCEL
By Views PDF module you can output a View as a PDF.


  With this module you can output a view as a PDF document. Each field of the view can be placed on the PDF page directly in the administration interface. Therefore a new display called "PDF" is added. 


Since you have your custom query, by Custom query in Views you can alter the results of the View. The print the output of view is PDF using the above module.



UPDATE

Since you created a node and fetch database result via that node you must use Printer, email and PDF versions module


  This module allows you to generate the following printer-friendly versions of any node:
  
  
  Printer-friendly version (webpage format) (at www.example.com/print/nid)
  PDF version (at www.example.com/printpdf/nid)
  EPUB version (at www.example.com/printepub/nid)
  Send by email (at www.example.com/printmail/nid)
  


where nid is the node id of content to render.

so by www.example.com/printpdf/nid you can create a  PDF output of the node.