0% found this document useful (0 votes)
28 views21 pages

IP Project

ip project
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views21 pages

IP Project

ip project
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

1|Page

INDIAN INTERNATIONAL SCHOOL

Submitted By: Aliasgar Limadiyawala

(Reg. No. 24544)


2|Page

INDIAN INTERNATIONAL SCHOOL

CERTIFICATE
Department of IP

This is to certify that Aliasgar Mustafa Limadiyawala of

class 11N has carried out the necessary Record Work under

my supervision for the academic year 2024-2025

Ms. Janathul Firthouse


(HOD, Dept. of IP)
Date: Tuesday, January 21, 2025
Year: 2024-25
3|Page

ACKNOWLEDGEMENT

I take this opportunity to convey my hearty and sincere


thanks to Ms. Janathul Firthouse, my IP teacher who
always gave valuable suggestions, support, encouragement,
and supervision for completion of my project. Her moral
support and continuous guidance enabled me to complete
my work successfully. I wish to express my sincere
gratitude to Dr. Manju Reji (Principal) and other staff for
their advice and guidance in completing this project. I take
this opportunity to convey my thanks to my Parents,
Friends and all those people who have helped me during the
journey of my Record Report, which I have completed
successfully. This report has given a wonderful and
enlightening experience to me.
4|Page

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.

Core Questions to Explore:


i]What is a database? Why are databases important in organizing and
managing information?
ii]How can we use SQL to create, update, and manage tables efficiently?
iii]What are some real-world examples where Python and MySQL are
used together?
iv]How can we use SQL queries to answer specific questions from data?
Objectives:
Creating Tables in MySQL
Create tables from questions that deal with storing, retrieving, and
organizing information. For example:
A table for student information (Name, Roll Number, Class, Marks, etc.).
A table for employee records (ID, Name, Department, Salary).
Incorporating and Modifying Data
find out how to insert records into the tables and also update existing
records. Example:
Add a new student's data.
Update a student's marks in a subject.
Retrieving Data with Queries
5|Page

Practice writing SQL queries to extract specific information. For example:


Find the student with the highest marks.
Extract the identities of employees whose earnings exceed a specified
salary threshold.
Understand the principles of databases and their application in the
effective storage and management of data.
Nurture skills in writing SQL queries for data manipulation.
Gain knowledge in integrating programming with databases for real-
world applications.
Solve real-life problems by managing and analyzing data Learning
Outcomes:
Once this project is completed, we will: Learn how to design, build, and
interact with tables in MySQL. Write SQL queries to solve data-related
questions. Use Python to making Program faster and more efficient. Apply
these skills to build mini-projects and understand how technology solves
everyday problems. This project is an advancement in understanding the
basic concepts of databases and programming, while simultaneously showing
their importance in today's digital world.
6|Page

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

Question and Answer


Python Question:
i]Write a program to find inputted number is even or odd
Ans:
print("********************************************************")
print("* ODD OR EVEN *")
print("********************************************************")
num=int(input('Enter the number which you check is even or odd:'))
if num%2==0:
print("The number",num,"is even")
else:
print("The number",num,"is odd")
Output:

ii]Write a Python program to convert Celsius into Fahrenheit


Ans:
print("*******************************************")
print("* CONVERT CELSIUS INTO FAHRENHEIT *")
print("*******************************************")
C=float(input('Enter the temperature in Celsius:'))
C*9/5+32=F
print('The temperature in Calsius',C,'C into Fahrenheit is',F,'F')
Output:
8|Page

iii]Write a Python program to create union of 2 list


Ans:
L1=[1,2,3,4,5]
print('First list is',L1)
L2=[6,7,8,9]
print('Second list is',L2)
print('The union of List 1 and List 2 is:',L1+L2)
Output:

iv]Write a python program to create union of 2 user defined list


Ans:
L1=[]
L2=[]
n1=int(input('Enter how big do you want list 1 to be:'))
for i in range(n1):
value=input('Enter the value you want to add to list 1:')
L1.append(value)
n2=int(input('Enter how big do you want list 2 to be:'))
for a in range(n2):
values=input('Enter the value you want to add to list 2:')
9|Page

L2.append(values)
print('The union of',L1,'And',L2,'is',L1+L2)
Output:

v]Create a user defined list for 4 name


Ans:
L1=[]
for i in range(4):
V=input('Enter the 4 names:')
L1.append(V)
print('List of name is',L1)
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

print("The numbber",a1,"and",a2,"are divisible by each other")


else:
print("The numbber",a1,"and",a2,"not are divisible by each other")
Output:

Vii] Write a program to find maximum of 3 numbers using nested if..else


statement.
Ans:
num1=int(input("Enter first number:"))
num2=int(input("Enter second number:"))
num3=int(input("Enter third number:"))
if num1 >= num2:
if num1 >= num3:
print(num1,"is largest number")
else:
print(num3,"is largest number")
else:
if num2 >= num3:
print(num2,"is largest number")
else:
print(num3,"is largest number")
Output:
11 | 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:

Consider the list given below and write the outputs :-


Nlist = ['p','y','t','h','o','n'']
1) Nlist.remove('p')
print(Nlist)
12 | P a g e

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:

2]Write all detail of Non-medical


Ans:
select * from student where steam = 'Non-medical';
Output:
15 | P a g e

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:

4]List all the detail of student sorted by Avg_marks in descending order


Ans:
select * from student order by Avg_marks desc;
Output:

5]Display the Name and Steam of Student whose grade is C


Ans:
select Name,Steam from student where grade = 'C';
Output:

6]Add a new column named ‘Phone_Number’


Ans:
Alter table student add column Phone_Number int;
16 | P a g e

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);

insert into Flight value(1005, 'Varanasi', 'Nepal', 275, STR_TO_DATE('12-Dec-07', '%d-%b-%y'),


3000), (2785, 'Delhi', 'Karala', 290, STR_TO_DATE('17-Jan-08', '%d-%b-%y'), 5500),
(6587,'Mumbai', 'Varanasi',435, STR_TO_DATE('19-Feb-08', '%d-%b-%y'),5000),(1265,
'Varanasi', 'Nepal',200, STR_TO_DATE('02-Jan-08', '%d-%b-%y'),5400),(4457, 'Delhi',
'Lucknow',150, STR_TO_DATE('22-Feb-08', '%d-%b-%y'),4500),(6856, 'Varanasi',
'Mumbai',180, STR_TO_DATE('03-Mar-08', '%d-%b-%y'),6000);
Output:
17 | P a g e

2]Display the Flights between Varanasi and Nepal


Ans:
SELECT Flight_No, Origin, Destination, Seats,DATE_FORMAT(Flightdate, '%d-%b-%y') AS
Flightdate, Rate FROM Flight where Origin='Varanasi' and Destination='Nepal';
Output:

3]Display the different Origin of Flights


Ans:
select distinct Origin from Flight;
Output:

4]To display list of Flight in Descending order of rate


Ans:
SELECT Flight_No, Origin, Destination, Seats,DATE_FORMAT(Flightdate, '%d-%b-%y') AS
Flightdate, Rate FROM Flight order by Rate desc;
Output:

5]To Display Flight Detail of Flights after Jan 2008


Ans:
SELECT Flight_No, Origin, Destination, Seats,DATE_FORMAT(Flightdate, '%d-%b-%y') AS
Flightdate, Rate FROM Flight where Month(Flightdate)>01 and Year(Flightdate)>2008;
18 | P a g e

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:

7]Change the Rate of Flight No 6587 From 6000 to 6500


Ans:
update Flight set Rate = 6500 where Flight_No = 6587;
Output:
19 | P a g e

Answer of core Questions


i) What is a database? Why are databases important in the organization and management of
information? Answer:

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:

• Facilitate the organized storage and retrieval of data.

• Promote data consistency while minimizing duplication.

• Allow access for multiple users while keeping security in check.

• 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:

• Allowing the creation of tables using the CREATE TABLE statement.

• Supporting the INSERT INTO statement to allow incorporation of data.

• Changing existing records by using the UPDATE command.

• Retrieving data using SELECT statements

• Modifying the structure of tables using ALTER TABLE

• Deleting unwanted records with DELETE

SQL enables one to work with data in a much efficient way.

iii]In which contexts is Python integrated with MySQL?

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

• Data Analytics: Extract data for Visualization and Reporting

• Automation: Automate data insertion and fetching processes.


20 | P a g e

•Inventory Management: Continual real-time monitoring of goods and their quantities.

•Healthcare Systems: Organization and management of patient records, including appointment


scheduling.

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:

• Trend analysis: Using SELECT with conditions.

• 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.

Creating Tables in MySQL

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);

Inserting and Modifying Data

Insert records into and update records in the database. Example:

• Enter information for an incoming student:

INSERT INTO Students (Name, RollNumber, Class, Marks) VALUES ('Alice', 101, '11A', 85);

• Update marks of any student:

UPDATE Students SET Marks = 90 WHERE RollNumber = 101;

Data Retrieval Using Queries

Get specific data with SQL statements. Examples:

•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.

You might also like