I'm trying
conn = MySQLdb.connect (host = "localhost",
user = "username",
passwd = "password",
db = "my_db")
cursor = conn.cursor ()
q = """IF NOT EXISTS CREATE TABLE %s (
course VARCHAR(15),
student VARCHAR(15),
teacher VARCHAR(15),
timeslot VARCHAR(15))""" % (d,)
cursor.execute(q)
But I get the error : _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 'IF NOT EXISTS CREATE TABLE ACCOUNTG (\\n\\t course VARCHAR(15),\\n\\t s' at line 1")
I'm not sure what's wrong with what I'm trying, I just want to make a table if it doesn't exist. Any input would be appreciated, thanks!