IP Project
IP Project
CERTIFICATE
Department of IP
class 11N has carried out the necessary Record Work under
ACKNOWLEDGEMENT
Objective
The project primarily seeks to improve our understanding of databases,
especially by using MySQL, and even more so to explore their integration
with Python for solving practical problems. It is with this project that we
shall attempt to design, create, and interact with tables in MySQL and use
Python for performing actions like adding, retrieving, and analyzing data.
Therefore, this will enable us to grow our knowledge of major database
management and programming concepts.
INDUX
No Name Page
1 Objective 4-5
2 Python Question 7-13
3 MySQL Question 14-18
4 Answering core 19-20
Questions
5 Learning Outcome 21
7|Page
L2.append(values)
print('The union of',L1,'And',L2,'is',L1+L2)
Output:
Vi] Write a Python program that accepts two integers from the user and prints a
message saying if first number is divisible by second number or not.
Ans:
a1=int(input("Enter the first numbber:"))
a2=int(input("Enter the second number:"))
if a1%a2==0:
10 | P a g e
Vii] Write a program to accept a list from user. Create 2 separate lists for odd
and even numbers from it.
Ans:
even_numbers = []
odd_numbers = []
a1=int(input("Enter the amount of value you want to enter:"))
for i in range(a1):
a2=int(input("Enter the values one by one:"))
if a2%2==0:
even_numbers.append(a2)
else:
odd_numbers.append(a2)
print(even_numbers)
print(odd_numbers)
Output:
2) print(Nlist.pop(3))
3) print(Nlist.pop())
4) print(Nlist[-2:-5])
5) print(Nlist*2)
Ans:
1['y', 't', 'h', 'o', 'n']
2'o'
3'n'
4[]
5['y', 't', 'h', 'y', 't', 'h']
ix] WAP that repeatedly asks the user to enter product names and prices. Store
all of them in a dictionary whose keys are product names and values are prices.
And also write a code to search an item from the dictionary.
Ans:
product={}
while True:
name=input("Enter product name(or type 'done' to stop):")
if name.lower()=='done':
break
price=float(input("Enter price:"))
product[name] = price
search = input("Enter the product name to search:")
if search in product:
print(f"The price of {search} is $",(product[search]))
else:
print(f"(search) not found")
Output:
13 | P a g e
14 | P a g e
MySQL Question:
i]Create the Table below in MySQL and write the queries with output
Ans:
1]Write the queries to make above Table in MySQL
Ans:
Use project
Create table student(No int,Name varchar(15),STIPEND int,Steam varchar(15),Avg_marks
float,Grade varchar(15),class varchar(15));
Insert into student values(1,'Amit',400,'Medical',78.5,'B','12B'),
(2,'Sumit',450,'Commerce',89.2,'A','11C'),(3,'Kumar',300,'Commerce',68.6,'C','12C'),
(4,'Ajeet',350,'Humanities',73.1,'B','12C'),(5,'Sujeet',500,'Non-medical',90.6,'A','11A'),
(6,'Deepak',400,'Medical',75.4,'B','12B'),(7,'Sabjay',250,'Humanities',64.4,'C','11A'),
(8,'Kuldeep',450,'Non-medical',88.5,'A','12A'),(9,'Mohit',500,'Non-medical',92.0,'A','12A'),
(10,'Arun',300,'Commerce',67.5,'C','12C');
Output:
3]List the Name of student who are in class 12 and sort them by STIPEND
Ans:
select Name from student where class like '12%' order by STIPEND asc;
Output:
Output:
7]Display the Name of student who are Non-medical and STIPEND more or equal to 450
Ans:
Select Name from student where Steam = “Non-medical” and STIPEND >=450;
Output:
ii]Create the Following Table in MySQL.Insert all records and Answer all the following queries
with output
Ans:
1]Insert all records
Ans:
create table Flight(Flight_No int,Origin varchar(15),Destination varchar(15),Seats int,Flightdate
date,Rate int);
Output:
6]Display Flight No ,Origin, Destination from Table where seats are greater than 270 and rate
greater than or equal to 5000
Ans:
select Flight_NO,Origin,Destination from Flight where Seats>270 and Rate>=5000;
Output:
Answer:
A database is a organized set of electronically stored data, therefore allowing efficient access,
management, and updating of the contained data. Information is organized to improve its
retrieval, administration, and analytical activities. Databases are very crucial in the management
of information since they:
• Facilities that can quickly and effectively survey and explain data.
ii) How can SQL be used to successfully create, alter and manage tables?
Answer:
SQL (Structured Query Language) is a formal way of interacting with databases. It allows for
efficient creation, alteration, and management of tables through the following statements:
Answer:
Some real-world examples where the combination of Python and MySQL is frequently used to
include:
• Web Development: User details, Blog articles, and e-commerce transaction history
Python can easily interface with MySQL using its libraries such as MySQL-connector and SQL
Alchemy.
iv) How can we use SQL queries to answer specific questions from data?
Answer:
With SQL queries, insight is obtained by specifying which data should be retrieved. Examples
include:
• Aggregation: GROUP BY and functions like SUM() and AVG() for totals and averages.
•Outlier detection: Using ORDER BY to sort data and find extreme values.
•Data comparison: Using JOIN statements to link tables and establish relationships.
Use SQL to create tables that are customized for particular applications. For instance:
CREATE TABLE Students (Name VARCHAR(50), RollNumber INT PRIMARY KEY, Class
VARCHAR(20), Marks INT);
CREATE TABLE Employees (ID INT PRIMARY KEY, Name VARCHAR(50), Department
VARCHAR(30), Salary int);
INSERT INTO Students (Name, RollNumber, Class, Marks) VALUES ('Alice', 101, '11A', 85);
•a-get details about the student who scored highest SELECT Name, MAX(Marks) AS
MaximumMarks FROM Students; • Find all employees whose salary is higher than a given
threshold. SELECT Name FROM Employees WHERE Salary > 50000;
21 | P a g e
Learning Outcome
This project will give students hands-on experience in using databases and the Python
programming language to enable them to develop useful technical competencies. Students will
be instructed on how to create and manage tables in MySQL efficiently. This is expected to
increase their understanding of what databases do: storing, organizing, and retrieving
information.
Give students the ability to write SQL queries for inserting, updating, and deleting. They will
practice retrieving specific information through the use of conditions, sorting, and grouping of
data, which will also help in developing problem-solving abilities.
The program aims at improving the appreciation of students on the importance of databases
and programming in today's digital world. Students will be guided through practical
applications, such as managing students' records, employees' information, and many other
instances where data plays a critical role.
At the end of the project, students will have a better understanding of database management
and programming but most importantly, it enhances logical reasoning and analytical skills. With
this knowledge gained, students will be confident to put these principles into practice and thus
making the project very of importance for their future scholarly and vocational pursuits.