<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 <h1>Python and MySQL</h1>
<h2>First import the python module containing the API</h2>
Step1:  <h2>Set up a connection and create a cursor object</h2>
Step3:  <h2>Execute a query and get the results</h2>
<ASSISTANT_TASK:>
Python Code:
import pymysql
Explanation: <h1>Python and MySQL</h1>
<h2>First import the python module containing the API</h2>
End of explanation
db = pymysql.connect("localhost","root","None" ,database="schooldb")
cursor = db.cursor()
Explanation: <h2>Set up a connection and create a cursor object</h2>
End of explanation
cursor.execute('show tables;')
cursor.fetchall()
               
query = 
SELECT course.name FROM student 
INNER JOIN enrolls_in ON student.ssn = enrolls_in.ssn 
INNER JOIN course ON course.number = enrolls_in.class
WHERE f_name = "JOHN";
cursor.execute(query)
cursor.fetchall()
# 向数据库插入数据
insert = 'INSERT INTO Student VALUES ("", "")' 
cursor.execute(insert)
cursor.fetchall()
# 同步到数据库
db.commit()
Explanation: <h2>Execute a query and get the results</h2>
End of explanation
<END_TASK>