SQL / Python Create Table Error
Question: I am getting a strange error when I am trying to create this table.... When I
track it back I have nothing on line 5? Can anyone help me on how to track
this error?

import settings import mysql.connector from database import login_info import
datetime as dt

    
    
    def main():
        db = mysql.connector.Connect(**login_info)
        cursor = db.cursor()
        sql =('DROP TABLE IF EXISTS messages')
        cursor.execute(sql)
        db.commit()
    
    message_table = """\
        CREATE TABLE messages(
            msgID INTEGER AUTO_INCREMENT PRIMARY KEY,
            message VARCHAR(500) DEFAULT NULL,
            subject VARCHAR(500) DEFAULT NULL,
           )"""
    cursor.execute(message_table)
    db.commit()
    

Error == mysql.connector.errors.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 5

I can connect ot SQl in an interactive window no problem.


Answer: Try removing the `,` at the end of line 4.

