skip to Main Content

ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘%s FROM Students INNER JOIN Courses ON Students.student_id = Courses.student_id’ at line 1

I am Expecting the code without any error

2

Answers


  1. It’s a programming error returned by the MySQL server. Your connection from Python app to MySQL is already successful.

    There is a syntax error from your SQL query. It seems you are using placeholder %s in columns selection. It is not supported, however.

    You can try something like

    "select" + columns + " FROM Students INNER JOIN Courses ON Students.student_id = Courses.student_id"
    
    Login or Signup to reply.
  2. For some reason, your string interpolation is not processed before passing the query, resulting in the "%s" being passed with the SQL statement. Check if the query you are passing is indeed processed and interpolates the %s to a meaningful value before you pass the query.

    Some more code context would be welcome.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search