Updated SQL queries