Interface Python With Mysql Notes
Interface Python With Mysql Notes
import mysql.connector
mycon.mysql.connector.connect(host="localhost",user="root",passwd="vbc",database="ymployee
details")
mycursor=mycon.cursor()
mycursor.erexeute("select *
row-mycursor.fetchmany(2)from emp")
fori in row:
print(;)
mycon.close()
Output:
empno name
1
arun
dept salary
2 IT
65000
kavitha CSC 60000
Note:- After executing the insert,
changes to the update and delete query must using
databse. commit () used to save the
Parameterized Queries: example: mycursor.commit()
Sometimes we need to run queries which are need on
outside. (or) some parameters or values that
We can pass values to provided from
query to perform dynamic search.
Various methods:
1.
3
sanjana Manager 75000