1. import sqlite3
connection = sqlite3.connect(“ABC.db”)
cursor = connection,cursor( )
cursor.execute(“SELECT Supplier.Name, Supplier.city,
Item.ItemName FROM Supplier, Item
where Supplier.Icode = Item.Icode AND Supplier.city NOT IN ‘Delhi'”)
co=[i[0] for i in cursor.description]
print(co)
result = cursor. fetchall( )
for r in result:
print(r)
Output:
[‘Name’ , ‘City’ , ‘ItemName’]
[‘Anu’ , ‘Bangalore’ , ‘Mouse’]
[‘Shahid’ , ‘Bangalore’ , ‘Monitor’]
[‘Akila’ , ‘Hydrabad’ , ‘Printer’]
[‘Girish’ , ‘Hydrabad’ , ‘Scanner’]
[‘Shylaja’ , ‘Chennai’ , ‘Monitor’]
[‘Lavanya’ , ‘Mumbai’ , ‘Printer’]
2. Increment the suppQty of Akila by 40 import sqlite3 connection = sqlite3.connect(“ABC.db”)
cursor = connection.cursor( )
cursor.execute(“UPDATE Supplier SET SuppQty =
SuppQty + 40 where Name = ‘Akila'”)
cursor.commit( )
result = cursor. fetchall( )
print(result)
connection.close( )
Output:
(S004, ‘Akila’ , ‘Hydrabad’ , 1005, 235)