Practical Answers
Practical Answers
import pickle
def add_record():
pickle.dump(record, file)
def display_records():
try:
print("Shoe Records:")
while True:
record = pickle.load(file)
print(record)
except EOFError:
pass
except FileNotFoundError:
def search_record(sid):
found = False
try:
while True:
record = pickle.load(file)
if record[0] == sid:
print("Record Found:", record)
found = True
break
except EOFError:
if not found:
except FileNotFoundError:
while True:
if choice == 1:
add_record()
elif choice == 2:
display_records()
elif choice == 3:
search_record(sid)
elif choice == 4:
break
else:
Set 1 q2
-> );
mysql> INSERT INTO Teacher (TeacherID, Tname, Department, DOJ, Salary, Gender) VALUES
3.Display Tname, DOJ, and Gender where Salary is less than 45000:
SELECT Tname, DOJ, Gender FROM Teacher WHERE Salary < 45000;
--------------------------------------------------------------------------------------------------------------------------------
set2 q1
stack = []
def push(element):
stack.append(element)
def pop():
if stack:
else:
print("Stack is empty.")
def display():
while True:
print("\nMenu:\n1. Push\n2. Pop\n3. Display\n4. Exit")
if choice == 1:
push(element)
elif choice == 2:
pop()
elif choice == 3:
display()
elif choice == 4:
break
else:
set2 q2
-> );
mysql> INSERT INTO Garment (Gcode, Gamename, Type, Number, Prizemoney, ScheduleDate)
VALUES
---------------------------------------------------------------------------------------------------------------------
set3 q1
import pickle
pickle.dump(dict1, file)
data = pickle.load(file)
set3q2
-> );
mysql> INSERT INTO Hospital (NO, NAME, AGE, DEPARTMENT, DATEOFADM, CHARGES, SEX) VALUES
-> (1, 'Arpan', 62, 'Surgery', '1998-01-21', 300, 'M'),
3. Find the department name and total number of patients in each department:
4. Find the names of female patients whose department name ends with 'y':
SELECT NAME FROM Hospital WHERE SEX = 'F' AND DEPARTMENT LIKE '%y';