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 WHERE Stream='Medical'"
cursor.execute(sql)
records = cursor.fetchall()
print("Answer is:")
for rec in records:
print(rec)
aW1wb3J0IG15c3FsLmNvbm5lY3RvcgpteWNvbiA9IG15c3FsLmNvbm5lY3Rvci5jb25uZWN0KAogICAgICBob3N0PSdsb2NhbGhvc3QnLAogICAgICB1c2VyPSdyb290JywKICAgICAgcGFzc3dvcmQ9J3Bhc3N3b3JkJywgCiAgICAgIGRhdGFiYXNlPSdTY2hvb2wnKQppZiBteWNvbi5pc19jb25uZWN0ZWQoKToKICAgcHJpbnQoJ0RhdGFiYXNlIGNvbm5lY3RlZCcpCmN1cnNvciA9IG15Y29uLmN1cnNvcigpCnNxbCA9IlNFTEVDVCAqIEZST00gU1RVREVOVCBXSEVSRSBTdHJlYW09J01lZGljYWwnIgpjdXJzb3IuZXhlY3V0ZShzcWwpCnJlY29yZHMgPSBjdXJzb3IuZmV0Y2hhbGwoKQpwcmludCgiQW5zd2VyIGlzOiIpCmZvciByZWMgaW4gcmVjb3JkczoKcHJpbnQocmVjKQ==