creating Tables and columns dynamically using mysql python connector
问题 I want to create a table having columns dynamically using python list. Column Names are in the list and I want to refer them in the MySQL query. I am using MySQL.connector with python 3.4.3. Below is the code which I tried: col names: ['Last Name', 'First Name', 'Job', 'Country'] table_name = 'stud_data' query = "CREATE TABLE IF NOT EXISTS"+table_name+"("+"VARCHAR(250),".join (col) + "Varchar(250))" print("Query is:" ,query) cursor.execute(query) conn.commit() But I am getting the following