Hi can anybody check my syntax error here? I tried to create a table in python's mysql.connector, but keep getting the same error no matter whatI changed.
CREATE TABLE IF NOT EXISTS #TTC (
City varchar(255),
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
PersonID int,
LastNameee varchar(255),
LaaaaaastName varchar(255),
LasssssstName varchar(255),
);
I keep getting error message from running this piece of code in a larger program,
MySQLInterfaceError Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mysql/connector/connection_cext.py in cmd_query(self, query, raw, buffered, raw_as_string)
486 query = query.encode('utf-8')
--> 487 self._cmysql.query(query,
488 raw=raw, buffered=buffered,
MySQLInterfaceError: 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 'varchar(255),
LastName varchar(255),
FirstName varchar(255),
' at line 2
During handling of the above exception, another exception occurred:
ProgrammingError Traceback (most recent call last)
<ipython-input-29-9ae0d306f12e> in <module>
13 print(create_table)
14
---> 15 cursor.execute(create_table)
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mysql/connector/cursor_cext.py in execute(self, operation, params, multi)
262
263 try:
--> 264 result = self._cnx.cmd_query(stmt, raw=self._raw,
265 buffered=self._buffered,
266 raw_as_string=self._raw_as_string)
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mysql/connector/connection_cext.py in cmd_query(self, query, raw, buffered, raw_as_string)
489 raw_as_string=raw_as_string)
490 except MySQLInterfaceError as exc:
--> 491 raise errors.get_mysql_exception(exc.errno, msg=exc.msg,
492 sqlstate=exc.sqlstate)
493 except AttributeError:
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 'varchar(255),
LastName varchar(255),
FirstName varchar(255),
' at line 2
,