Finished implementing SQL queries