1.

Write a program to count the number of records in a table?

Answer»

Example 1 :

In this example we are going to count the number of records( rows)

import sqlite3

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

cursor = connection.cursor( ) 

cursor.execute(“SELECT COUNT(*) FROM student”)

result = cursor. fetchall( )

print( result)

Output:

[(7,) ]



Discussion

No Comment Found