Added methods for SQL queries

Added methods for SQL queries since they will be all used by the various
data accessing functions.