**已关闭。**此问题为not reproducible or was caused by typos。目前不接受回答。
这个问题是由错字或无法再重现的问题引起的。虽然类似的问题在这里可能是on-topic,但这个问题的解决方式不太可能帮助未来的读者。
昨天就关门了。
Improve this question
Traceback (most recent call last):
File "C:\Users\Donchaka\Desktop\ADVANCED PY\05 SQL\Creating a Table.py", line 62, in <module>
cursor.execute ("CREATE TABLE People (Name varchar(50), Age int, City varchar(50)" )
File "C:\Users\Donchaka\AppData\Roaming\Python\Python37\site-packages\mysql\connector\cursor.py", line 551, in execute
self._handle_result(self._connection.cmd_query(stmt))
File "C:\Users\Donchaka\AppData\Roaming\Python\Python37\site-packages\mysql\connector\connection.py", line 490, in cmd_query
result = self._handle_result(self._send_cmd(ServerCmd.QUERY, query))
File "C:\Users\Donchaka\AppData\Roaming\Python\Python37\site-packages\mysql\connector\connection.py", line 395, in _handle_result
raise errors.get_exception(packet)
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
# creating a TABLE
db = mysql.connector.connect(host="localhost",user="root",password="",database="testdb")
cursor = db.cursor()
cursor.execute("CREATE TABLE People (Name varchar(50), Age int, City varchar(50)")
的一个字符串
1条答案
按热度按时间62o28rlo1#
我看到你的SQL语句缺少了一个用于CREATE TABLE命令的右括号。
下面是更正后的SQL语句:
CREATE TABLE People (Name varchar(50), Age int, City varchar(50));