Correcting wrong SQL syntax