Ошибка в запросе SQL (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syn
Сперва я создал таблицу и всё ок
create_table_users = "CREATE TABLE `users`(id int AUTO_INCREMENT," \
"name varchar(32)," \
"password varchar(32)," \
"email varchar(32), PRIMARY KEY (id));" # нужно для регистрации
cursor.execute(create_table_users)
но когда я пытаюсь вставить данные следующим кодом у меня возникает ошибка
sql = "INSERT INTO 'users' (name, password, email) VALUES (%s, %s, %s)"
val = ("nick_name", "pass_word", "email")
cursor.execute(sql, val)
connection.commit()
Сама ошибка
pymysql.err.ProgrammingError: (1064, "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 ''users' (name, password, email) VALUES ('nick_name', 'pass_word', 'email')' at line 1")
Ответы (1 шт):
Автор решения: tiovi
→ Ссылка
sql = "INSERT INTO users (name, password, email) VALUES (%s, %s, %s)"
Замените на это