Class 12th IP (065)
Practical 9
SOLUTION :-
import pandas as pd
import matplotlib.pyplot as plt
Result = pd.DataFrame({
'Name': ['Harsh', 'Meena', 'Parth', 'Kishore', 'Krishna'],
'Science': [99, 85, 75, 75, 70],
'Maths': [95, 45, 96, 98, 60],
'Eng': [60, 63, 63, 63, 45]
})
print(Result)
while True:
print("\n*** MENU ***")
print("1. Show All Data")
print("2. Add New Row")
print("3. Add Total Column")
print("4. Create CSV File")
print("5. Create Bar Graph")
print("6. Exit")
ch = int(input("Enter your choice: "))
if ch == 1:
print(Result)
elif ch == 2:
Result.loc[len(Result)] = ['Pankaj', 50, 50, 50]
print("New row added successfully")
elif ch == 3:
Result['Total'] = Result['Science'] + Result['Maths'] + Result['Eng']
print(Result)
elif ch == 4:
Result.to_csv("Data.csv", index=False)
print("CSV file created successfully")
elif ch == 5:
plt.bar(Result['Name'], Result['Total'])
plt.title("Student Result Report")
plt.xlabel("Student Name")
plt.ylabel("Total Marks")
plt.show()
elif ch == 6:
break
else:
print("Invalid Choice")
SOLUTION
Create Database
CREATE DATABASE B4_2026; USE B4_2026;
Create Table Bank
CREATE TABLE Bank ( Ano VARCHAR(50) PRIMARY KEY, Name VARCHAR(50), Balance FLOAT(9,2), Dateofopen DATE, Transaction VARCHAR(20) );
Insert 8 Records
INSERT INTO Bank VALUES ('SB1','Mr. Anil',15000.25,'2011-02-04','7'), ('SB2','Mr. Amit',1500.50,NULL,'8'), ('SB3','Mrs. Sakshi',45000.00,'2012-03-22','5'), ('SB4','Mr. Goyal',23812.35,'2013-09-05',NULL), ('SB5','Mr. Denish',63459.80,'2009-11-10','15'), ('SB6','Mrs. Madhu',26953.55,'2021-03-02','3'), ('SB7','Mr. Chirag',4500.63,NULL,'3'), ('SB8','Mr. Tarak',450000.00,'2005-06-20','9');
4. SQL Queries
a) Display account number, name and date of open where transaction > 8
SELECT Ano, Name, Dateofopen FROM Bank WHERE Transaction > 8;
b) Display account holders whose Dateofopen is not mentioned
SELECT * FROM Bank WHERE Dateofopen IS NULL;
c) Change transaction value for Mr. Chirag to 6
UPDATE Bank SET Transaction = '6' WHERE Name = 'Mr. Chirag';
d) Display all account holders in descending order of Dateofopen
SELECT * FROM Bank ORDER BY Dateofopen DESC;
e) Remove accounts whose transaction is NULL
DELETE FROM Bank WHERE Transaction IS NULL;