Ukraine1449
Ukraine1449

Reputation: 29

mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax when trying to create a table

mysql.connector.errors.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 'Rank int, XP int, PRIMARY KEY (UUID))' at line 1

the code is using mysql.connector in python 3.9

c.execute('CREATE TABLE IF NOT EXISTS UserActivity(UUID int, TotalMessages int, Rank int, XP int, PRIMARY KEY (UUID))')

Upvotes: 0

Views: 1471

Answers (1)

Ukraine1449
Ukraine1449

Reputation: 29

The word Rank is a reserved keyword, had to replace all instances of Rank with UR

c.execute('CREATE TABLE IF NOT EXISTS UserActivity(UUID int, TotalMessages int, UR int, XP int, PRIMARY KEY (UUID))')

Upvotes: 1

Related Questions