Added Terminal logging for SQL queries