BK XII IP MySQL Data Base Connectivity
BK XII IP MySQL Data Base Connectivity
Pymysql
Mysql.connector
MySQLdb
Python can be used in database applications. One of the most popular databases is MySQL. Pthon Database API
supports a wide range of database servers such as –
What is PyMySQL ?
PyMySQL is an interface for connecting to a MySQL database server from Python. It implements the Python
Database API v2.0 and contains a pure-Python MySQL client library. The goal of PyMySQL is to be a drop-in
replacement for MySQLdb.
What is MySQL-Connector ?
MySQL Connector/Python is an API implemented using pure Python. It means that you don't need to install
anyMySQL client library or any Python modules except the standard library.
What is MySQLdb ?
MySQLdb is an interface to the popular MySQL database server for Python. The design goals are:
Output –
Program11:- Write Command to Select all records from the "customers" table, and display the result:
Program12:- Write Command to Select only the name and address columns:
Program13:- Write Command to select only Fetch only one row:
The fetchone() method will return the first row of the result:
Program14:- Write Command to delete any record.
mycursor.execute(sql)