हिंदी
तमिलनाडु बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान कक्षा १२

Write the Python script to display all the records of the following table using fetchmany(). Icode ItemName Rate 1003 Scanner 10500 1004 Speaker 3000 1005 Printer 8000 1008 Monitor 15000 - Computer Science

Advertisements
Advertisements

प्रश्न

Write the Python script to display all the records of the following table using fetchmany().

Icode ItemName Rate
1003 Scanner 10500
1004 Speaker 3000
1005 Printer 8000
1008 Monitor 15000
1010 Mouse 700
संक्षेप में उत्तर
Advertisements

उत्तर

Database : supermarket
Table : electronics
Python Script:
import sqlite3
connection = sqlite3.connect
(”supermarket. db”)
cursor = connection.cursor()
cursor.execute
(“SELECT * FROM electronics “)
print(“Fetching all 5 records :”)
result = cursor.fetchmany(5)
print(*result,sep=” \ n”)

Output:
Fetching all 5 records :
(1003,’Scanner’ ,10500)
(1004,’Speaker’,3000)
(1005,’Printer’,8000)
(1008,’Monitor’,15000)
(1010,’Mouse’,700)

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 15: Data manipulation through SQL - Evaluation [पृष्ठ ३१८]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 12 TN Board
अध्याय 15 Data manipulation through SQL
Evaluation | Q 2. | पृष्ठ ३१८
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×