functions for queries

Set up the functions for building the queries for the MySQL database