0
Pycharmにおけるコード:Pycharm:のMySQLdbとデータベース
import MySQLdb
db = MySQLdb.connect("127.0.0.1", "xxx", "xxx", "xxxxxxx")
cursor = db.cursor()
sql="""CREATE TABLE EMPLOYEE (
FIRST_NAME CHAR(20) NOT NULL,
LAST_NAME CHAR(20),
AGE INI,
SEX CHAR(1),
INCOME FLOAT)"""
cursor.execute(sql)
db.close()
問題:終了コードで終了
/usr/bin/python2.7 /home/mfae/PycharmProjects/dbs/create.py
/usr/lib/python2.7/dist-packages/pkg_resources.py:1031: UserWarning: /home/mfae/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
warnings.warn(msg, UserWarning)
Traceback (most recent call last):
File "/home/mfae/PycharmProjects/dbs/create.py", line 14, in <module>
cursor.execute(sql)
File "build/bdist.linux-i686/egg/MySQLdb/cursors.py", line 205, in execute
File "build/bdist.linux-i686/egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INI,\n SEX CHAR(1),\n INCOME FLOAT)' at line 4")
Process finished with exit code 1
工程1 プロセス終了コード完成1つの プロセスを終了終了コード1付き
どのような解決策ですか?
「AGE」のデータ型を「INT」に変更します。 – Viki888
年齢?またはAGE INT? – FisherMartyn
おかげさまですべての解決が完了しました – mfae