Xii CSC Interface Programs Record
Xii CSC Interface Programs Record
AIM:
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: