import pymysql
db=pymysql.connect('localhost','root','password','database_name')
cursor=db.cursor()
cursor.execute('drop table if EXISTS class')
sql='''create table class(
id int not null PRIMARY KEY auto_increment,
first_name char(20) NOT NULL ,
last_name CHAR (20),
age INT,
sex CHAR (1),
income FLOAT )
'''
cursor.execute(sql)
db.close()