Create a method to print out query result