mycon
= mysql.connector
.connect
( host='localhost',
user='root',
password='password',
database='School')
if mycon.is_connected():
print('Database connected')
cursor = mycon.cursor()
sql ='SELECT Stream, COUNT(*) FROM STUDENT GROUP BY Stream'
cursor.execute(sql)
data = cursor.fetchall()
print("Answer is:")
for rec in data:
print(rec)
aW1wb3J0IG15c3FsLmNvbm5lY3RvcgpteWNvbiA9IG15c3FsLmNvbm5lY3Rvci5jb25uZWN0KCAKICAgIGhvc3Q9J2xvY2FsaG9zdCcsIAogICAgdXNlcj0ncm9vdCcsCiAgICBwYXNzd29yZD0ncGFzc3dvcmQnLAogICAgZGF0YWJhc2U9J1NjaG9vbCcpCmlmIG15Y29uLmlzX2Nvbm5lY3RlZCgpOgogICBwcmludCgnRGF0YWJhc2UgY29ubmVjdGVkJykKY3Vyc29yID0gbXljb24uY3Vyc29yKCkKc3FsID0nU0VMRUNUIFN0cmVhbSwgQ09VTlQoKikgRlJPTSBTVFVERU5UIEdST1VQIEJZIFN0cmVhbScKY3Vyc29yLmV4ZWN1dGUoc3FsKQpkYXRhID0gY3Vyc29yLmZldGNoYWxsKCkKcHJpbnQoIkFuc3dlciBpczoiKQpmb3IgcmVjIGluIGRhdGE6CiAgICBwcmludChyZWMp