# 导入pymysql
import pymysql

# 创建连接
con = pymysql.connect(host="localhost", user="root", password="123456", database="howk", port=3306)

# 创建游标对象
cur = con.cursor()

# 编写创建表的sql

for num in range(21, 23):
    # print (num)
    tablename = "user" + str(num)
    print(tablename)
    # sql = "CREATE TABLE  %s (col1 INT PRIMARY KEY     NOT NULL,nane    varchar(300)   )" % tablename
    sql = "CREATE TABLE  %s (userid int(4) primary key not null auto_increment,name    varchar(300)   )" % tablename

    try:
        # 执行创建表的sql
        cur.execute(sql)
        import time
        time.sleep(1)
        for i in range(1,10):
            sql = 'insert into %s (name) values("name%s")'%(tablename,i)
            cur.execute(sql)  # 第二个参数可以是元组也可以是列表

        con.commit()
        print("创建表成功")
    except Exception as e:
        print(e)
        print("创建表失败")
# for num in range(14, 15):

cur.close()
        # 关闭数据库连接
con.close()
inner join
SELECT m.user_id,b.user_id FROM mp_user_org AS m INNER JOIN mp_user_employee AS b ON m.user_id=b.user_id WHERE b.phone='13800003056'

 两表删除

DELETE mp_user_org,
mp_user_employee 
FROM
    mp_user_org
    INNER JOIN mp_user_employee ON mp_user_org.user_id = mp_user_employee.user_id 
WHERE
    mp_user_employee.phone = '13800003056';