Saved Bookmarks
| 1. |
Write the Python script to display all the records of the following table using fetchmany( ) |
||||||||||||||||||
Answer»
import sqlite3 connectoin = sqlite3.connect(“company.db”) cursor = connection.cursor() cursor.execute(“Select * from product”) print(“Displaying Records”) result = cursor.fetchmany(5) print(*result, Sep = “\n”) Output: Displaying records (1003, ‘Scanner’ , 10500) (1004, ’Speaker’ , 3000) (1005, ‘Printer’ , 8000) (1008, ’Monitor’ , 15000) (1010, ‘Mouse’ , 700) |
|||||||||||||||||||