added more sql code for queries