Page 38 - ipp11
P. 38
vehicles[reg_no] = {
"Model": model,
"Owner": owner,
"Price": price
}
search_reg_no = input("\n Enter Registration Number to search: ")
if search_reg_no in vehicles:
print("\n Vehicle Details:")
print("Registration Number:", search_reg_no)
print("Model:", vehicles[search_reg_no]['Model'])
print("Owner:", vehicles[search_reg_no]['Owner'])
print("Price:", vehicles[search_reg_no]['Price'])
else:
print("Vehicle not found!")
OR
(b) Science
{'Name': 'Mehul Chawla', 'Subject': 'Science', 'Qualification': 'M.Sc'}
35. Consider the following tables. (4)
Table: Employees
EmployeeID Name Department Salary
1101 Raman Malhotra HR 55000
2091 Priyanka Sharma IT 78000
3065 Amrita Verma Finance 65000
4002 Nehal Khanna IT 89000
5108 Anjum Mehta Marketing 52000
Table: Projects
ProjectID ProjectName EmployeeID StartDate
1001 AI Development 2091 2025-02-15
1002 Web Design 4002 2025-03-10
1003 Finance Audit 3065 2025-01-20
1004 HR Analytics 1101 2025-04-05
1005 Digital Marketing 5108 2025-02-28
Write SQL queries for (a) and (b) and write the outputs for (c) to (e) on the basis of tables Employees and
Projects.
(a) Write a query to add column Experience in the table Employees.
(b) Write a query to display the details of employees whose name contains the letter ‘e’.
(c) SELECT * FROM Employees WHERE Department = "IT" AND Salary > 60000;
(d) SELECT Name, Salary FROM Employees WHERE Salary > 55000;
(e) SELECT ProjectName, StartDate FROM Projects WHERE StartDate BETWEEN
'2024-02-01' AND '2024-03-31';
Ans. (a) ALTER TABLE EMPLOYEES ADD EXPERIENCE INT (5);
(b) SELECT * FROM EMPLOYEES WHERE NAME LIKE '%e%';
(c)
EmployeeID Name Department Salary
2091 Priyanka Sharma IT 78000
4002 Nehal Khanna IT 89000
M.8