Class 12th IP (065)
Practical 11
SOLUTION :-
import pandas as pd
import matplotlib.pyplot as plt
Flight = pd.DataFrame({
'Fname': ['Air india', 'Indigio', 'Spice Jet', 'Jet', 'Emirates'],
'Year': [2010, 2010, 2012, 2010, 2012],
'Month': ['January', 'March', 'January', 'December', 'December'],
'Customer': [25, 50, 35, 55, 65]
})
print(Flight)
while True:
print("\n*** MENU ***")
print("1. Show All Data")
print("2. Add New Row")
print("3. Add Fare Column")
print("4. Create CSV File")
print("5. Create Bar Graph")
print("6. Exit")
ch = int(input("Enter your choice: "))
if ch == 1:
print(Flight)
elif ch == 2:
Flight.loc[len(Flight)] = ['Luftanza', 2012, 'August', 86]
print("New row added successfully")
elif ch == 3:
Flight['Fare'] = 25000
print(Flight)
elif ch == 4:
Flight.to_csv("Data.csv", index=False)
print("CSV file created successfully")
elif ch == 5:
plt.bar(Flight['Fname'], Flight['Customer'])
plt.title("Flight Wise Passenger Report")
plt.xlabel("Flight Name")
plt.ylabel("Passengers")
plt.show()
elif ch == 6:
break
else:
print("Invalid Choice")
SOLUTION
Create Database
CREATE DATABASE B1_2026; USE B1_2026;
Create Table GYM
CREATE TABLE GYM ( Mcode INT PRIMARY KEY, Mname VARCHAR(50), Gender VARCHAR(50), Age INT, FeeGiven INT, Type VARCHAR(50), DtAdmit DATE );
Insert 8 Records
INSERT INTO GYM VALUES (1,'Amrish','Male',35,6000,'Monthly','2016-01-23'), (2,'Rasmi','Female',25,8000,'Monthly','2016-09-23'), (3,'George','Male',42,24000,'Yearly','2011-06-27'), (4,'Aryan','Male',27,12000,'Quarterly','2012-10-16'), (5,'Samit','Male',54,6000,'Monthly','2015-09-20'), (6,'Laxmi','Female',43,500,'Guest','2016-01-15'), (7,'Samita','Female',22,24000,'Monthly','2017-07-18'), (8,'Ajit','Male',51,12000,'Quarterly','2013-07-08');
4. SQL Queries
a) Display Mname, Age, FeeGiven of members whose fee is above 12000
SELECT Mname, Age, FeeGiven FROM GYM WHERE FeeGiven > 12000;
b) Delete the record for Ajit
DELETE FROM GYM WHERE Mname = 'Ajit';
c) Display Mname and FeeGiven in ascending order of Age
SELECT Mname, FeeGiven FROM GYM ORDER BY Age ASC;
d) Change FeeGiven for Samita to 50
UPDATE GYM SET FeeGiven = 50 WHERE Mname = 'Samita';
e) Display types of memberships (no duplicates)
SELECT DISTINCT Type FROM GYM;