在Python / SQL中创建数据库的语法错误

时间:2015-11-08 16:09:44

标签: python sql database

我想使用以下内容创建一个表:

def Create_Table():
c.execute("CREATE TABLE Interview_Test_Stat (
Employees VARCHAR(2) CHARACTER SET utf8,
 VARCHAR(7) CHARACTER SET utf8,
 VARCHAR(6) CHARACTER SET utf8,
 VARCHAR(7) CHARACTER SET utf8,
 INT,
Bosses VARCHAR(2) CHARACTER SET utf8,
Column_7 VARCHAR(6) CHARACTER SET utf8,
Column_8 VARCHAR(6) CHARACTER SET utf8)"
)

但是当我运行它时,我收到以下错误:

Traceback (most recent call last):
File "<string>", line 301, in runcode
File "<interactive input>", line 1, in <module>
File "C:\Users\Rony\Desktop\Tables.py", line 21, in Create_Table
c.execute("CREATE TABLE Interview_Test_Stat (Employees VARCHAR(2) CHARACTER SET utf16, VARCHAR(7) CHARACTER SET utf16, VARCHAR(6) CHARACTER SET utf16, VARCHAR(7) CHARACTER SET utf16, INT,Bosses VARCHAR(2) CHARACTER SET utf16, Column_7 VARCHAR(6) CHARACTER SET utf16, Column_8 VARCHAR(6) CHARACTER SET utf16)")
sqlite3.OperationalError: near "CHARACTER": syntax error

我不确定我做错了什么。

0 个答案:

没有答案