我正在数据库中创建一个新表。我以前在创建其他表时也这样做过,但这次我遇到了一个语法错误。据我所知,语法是正确的。所以我想不出来
下面是引发错误的语句的代码段:
cursor.execute('''
CREATE TABLE IF NOT EXISTS order(
orderID INTEGER PRIMARY KEY,
productname STRING,
productprice FLOAT,
productquanitity INTEGER,
producttotal INTEGER;''')
这是错误:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1533, in __call__
return self.func(*args)
File "N:/NEW/cashregister.py", line 42, in okitem
producttotal INTEGER;''')
sqlite3.OperationalError: near "order": syntax error
如果能就发生这种情况的原因提出一些建议,我将不胜感激
order
是SQL中的保留关键字;见documentation for the full list of reserved keywords that SQLite uses使用
"order"
使SQLite理解它将被解释为表名。您还忘记了结束)
:相关问题 更多 >
编程相关推荐