SQL queries edited