import mysql.connector
mycon = mysql.connector.connect(
host='localhost',
user='root',
password='password',
database='School')
if mycon.is_connected():
print('Database connected')
cursor = mycon.cursor()
sql ="SELECT * FROM STUDENT ORDER BY Name"
cursor.execute(sql)
data = cursor.fetchall()
print("Answer is:")
for rec in data:
print(rec)
sql ="DELETE FROM STUDENT WHERE ID = 3"
cursor.execute(sql)
mycon.commit()
mycon.close()