SQL query checks added