python sqlite3 求助
conn= sqlite3.connect('test.db')c = conn.cursor()
c.execute('''CREATIVE TABLE COMPANY
...: (ID INT PRIMARY KEY NOT NULL,
...: NAME TEXTNOT NULL
...: AGE INT NOT NULL
...: ADDRESS CHAR(50)
...: SALARY REAL);''')
Traceback (most recent call last):
File "C:\Users\金荣宇\AppData\Local\Programs\Python\Python38\lib\site-packages\IPython\core\interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-6-ed16ae38eff9>", line 1, in <module>
c.execute('''CREATIVE TABLE COMPANY
sqlite3.OperationalError: near "CREATIVE": syntax error
代码如上,刚开始接触sqlite3,就照着教程打了代码,但是会出现以上的错误不知道该怎么解决,求大佬指教 拼写错误了
create 啥教程啊 扔了得了
c.execute('''CREATE TABLE COMPANY(ID INT PRIMARY KEY NOT NULL, NAMETEXTNOT NULL, AGE INT NOT NULL , ADDRESS CHAR(50), SALARY REAL);''')
另:批量代码建议在py文件里弄,不要在>>>符号下弄
页:
[1]