0% found this document useful (0 votes)
8 views8 pages

Xii CSC Interface Programs Record

The document outlines several Python functions to interface with a MySQL database, specifically for operations on tables STATIONERY, COMPANY, CUSTOMER, and DOCTOR. Each function aims to perform a specific task such as adding, counting, searching, or deleting records based on defined criteria. The database connection details are consistent across all operations, using localhost with specified username and password.

Uploaded by

use121313
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views8 pages

Xii CSC Interface Programs Record

The document outlines several Python functions to interface with a MySQL database, specifically for operations on tables STATIONERY, COMPANY, CUSTOMER, and DOCTOR. Each function aims to perform a specific task such as adding, counting, searching, or deleting records based on defined criteria. The database connection details are consistent across all operations, using localhost with specified username and password.

Uploaded by

use121313
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

20.

INTERFACE PYTHON WITH MYSQL – FETCHING RECORDS

AIM:

To write the following Python function to perform the specified operation:AddAndDisplay():


To input details of an item and store it in the table STATIONERY. The function should then
retrieve and display all records from the STATIONERY table where the Price is greater than 120.
A table, named STATIONERY, in MYDB database, has the following structure:
Field Type
itemNo int(11)
itemName Varchar(15)
price float
quantity int(11)
Note: Assume the following for Python-Database connectivity:
 Host: localhost
 Username: root
 Password: 12345
PROGRAM:

RESULT:
Thus the given program executed successfully.
OUTPUT:
21. INTERFACE PYTHON WITH MYSQL – COUNTING RECORDS

AIM:
To write the following Python function to perform the specified operation: CountAndDisplay():
The function should count and display all records from the COMPANY table where the city is
Delhi.
A table, named COMPANY, in MYDB database, has the following structure:
Field Type
Cid int(11)
CName Varchar(15)
City Varchar(15)
ProductName Varchar(15)
Note: Assume the following for Python-Database connectivity:
 Host: localhost
 Username: root
 Password: 12345
PROGRAM:

RESULT:
Thus the given program executed successfully.
OUTPUT:
22. INTERFACE PYTHON WITH MYSQL – SEARCHING A RECORD
AIM:
To write the following Python function to perform the specified operation: SearchAndDisplay():
The function should search the customer records using Product Name from the Customer table,
if it is present in table display the record.
A table, named CUSTOMER, in MYDB database, has the following structure:
Field Type
C_ID int(11)
Customer_Name Varchar(15)
Product Varchar(15)
Price int(11)
Note: Assume the following for Python-Database connectivity:
 Host: localhost
 Username: root
 Password: 12345
PROGRAM:

RESULT:
Thus the given program executed successfully.
OUTPUT:
23. INTERFACE PYTHON WITH MYSQL – DELETING A RECORD
AIM:
To write the following Python function to perform the specified operation: DeleteAndDisplay():
The function should delete the Male records from the DOCTOR table and display first three
records.
A table, named DOCTOR, in MYDB database, has the following structure:
Field Type
Did int(11)
Doctor_Name Varchar(15)
Department Varchar(15)
Gender Char(1)
Experience int(11)
Note:
Assume the following for Python-Database connectivity:
 Host: localhost
 Username: root
 Password: 12345
PROGRAM:

RESULT:
Thus the given program executed successfully.
OUTPUT:

You might also like