Fix third table and last 2 SQL query formatting.