Fixes to SQL queries (missing ';')