Create table in mysqldb
Question: 
    Traceback (most recent call last):
    
      File "****", line 17, in module
        cur.execute("CREATE TABLE `Project1`(`Id` INT PRIMARY KEY NOT NULL ,`TERM` VARCHAR(25) CHARACTER SET utf8 NOT NULL, `TYPE1` VARCHAR(25) CHARACTER SET utf8 NOT NULL, `ACTION` VARCHAR(30) CHARACTER SET utf8 NOT NULL, `CERTAINITY` DOUBLE(3) NOT NULL");
      File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 205, in execute
        self.errorhandler(self, exc, value)
      File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
        raise errorclass, errorvalue
    _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 ') NOT NULL' at line 1")
    

line 1: import mysqldb as mdb

after rectifying the double problem, I got a similar error, with the last
sentence changed as _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 '' at line 1")

the line to create tables was modified to CREATE TABLE `Project1`(`Id` INT
PRIMARY KEY NOT NULL ,`Term` VARCHAR(25) CHARACTER SET utf8 NOT NULL, `Type1`
VARCHAR(25) CHARACTER SET utf8 NOT NULL, `Action` VARCHAR(30) CHARACTER SET
utf8 NOT NULL, `Certainity` DOUBLE(4,3) NOT NULL)

NEW PROBLEM,

I changed 'Certainity' to string

    
    
        File "/home/ankitaprasad/Ontology Project3/Stanford.py", line 57, in <module>
        cur.execute("""INSERT INT0 Project1(Term, Type1, Action, Certainity) VALUES (%s,%s,%s,%s)""",(term,type1,action,ab));
         File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
         File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
          _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 'Project1(Term, Type1, Action, Certainity) VALUES ('','','','0')' at line 1")
    

[Finished in 1.2s with exit code 1]

here ab=str(mod)


Answer: First off, your entire create statement formatted into this:

    
    
    CREATE TABLE `Project1` (
        `Id` INT PRIMARY KEY NOT NULL,
        `TERM` VARCHAR(25) CHARACTER SET utf8 NOT NULL,
        `TYPE1` VARCHAR(25) CHARACTER SET utf8 NOT NULL,
        `ACTION` VARCHAR(30) CHARACTER SET utf8 NOT NULL,
        `CERTAINITY` DOUBLE(3) NOT NULL
    

See where you are missing the closing parentheses? Fixing that, you still have
a problem as [`DOUBLE`](https://dev.mysql.com/doc/refman/5.5/en/floating-
point-types.html) require _two_ arguments, not one, so that is a syntax error
for MySQL. Please read the documentation and carefully look at what you wrote
before asking questions and it will save you a lot of time, especially shortly
before a deadline.

