我在对象初始值设定项中有以下代码片段。但是,下面的第三行给出错误 sqlite3.OperationalError: close "(": 语法错误
self._conn = sqlite3.connect('dictionary')
cursor = self._conn.cursor()
cursor.execute('CREATE TABLE `words` (`word` VARCHAR(15) NOT NULL, PRIMARY (`word`));')
关于可能导致此问题的任何想法。我离 SQL 导出还很远,但我看不到我做错了什么。
最佳答案
您在这里缺少KEY
。
CREATE TABLE `words` (`word` VARCHAR(15) NOT NULL, PRIMARY KEY(`word`))
关于python - python中sqlite语句的语法错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7103416/