1.

Write a program to count the number of male and female students from the student table Example

Answer»

import sqlite3

connection= sqlite3.connect(“Academy.db”)

cursor = connection.cursor( ) 

cursor.execute(“SELECT gender,count(gender) FROM student Group BY gender”)

result = cursor. fetchall( )

print(*result,sep= ”\n”)

OUTPUT

(‘F’, 2)

(‘M’ , 5)



Discussion

No Comment Found