Q. Explain what the following query will do?


import mysql.connector

db = mysql.connector.connect(….)

cursor = db.cursor()

person_id = input("Enter required person id")

lastname = input("Enter required lastname")

db.execute("INSERT INTO staff (person_id, lastname) VALUES ({}, ‘{}’) ".

format (person_id, lastname))

db.commit()

db.close()



Answer =

This above program insert a new records in table staff such that person_id and lastname are input by user. When program has run.

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post