0% found this document useful (0 votes)
13 views

PYTHON AND SQL

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

PYTHON AND SQL

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Name : Varun Sharma

Class : 11th A

ROLL NO. : 21

Subject : Informatics Practices

Subject code : 065

Content of project : -> Structured


Query Language ( SQL) and it’s
applications
->PYTHON PROGRAMS
certificate

This is to certify that Varun Sharma


successfully completed the project
work through the guidance of MRS.
PINKI SAINI (subject teacher ) on
Informatics practices for class 11th
Practical Examination of Central
Board of Secondary Education in the
year 2023 - 2024. This for that this
project is the individual work of the
candidate.

T. SIGN.
ACKNOWLWDGEMENT

I would like to express my special thanks of


gratitude to my teacher MRS. Pinki saini , who
gave me the golden opportunity to do this
wonderful project of Business Studies on
"SQL APPLICATIONS AND PYTHON
PROGRAMS ", Who also helped me in
completing my project. I came to know about so
many new things. I am really thankful to them.
Secondly I would also like to thank my parents
and friends who helped me a lot in finalizing
this project within the limited time frame.
VARUN SHARMA
XI SCIENCE
Content:-
MYSQL:-
1. To check if a database by the name newdb exits.
2. to create STUDENT table with the studentid,
section,class,gender,name,dob,and marks.
3. Create table employee with the given structure.
4. Create job table job with given structure .
5. SQL command to create new table old which has exactly the same
structure as the student table.
6. Write SQL command to create a new table OLDSTU with only
studentid , gender, name and dob from the student table.
7. Add the given data in the above table (employee) as instructed.
8. Insert into empt table, the employee numbers, names , and
salaries of all those employees of temp table that havre completed
2 years.
9. Display distinct species of pets from the table pet.
10. Display species of all pets from table.
11. Write a query to diplay name and sex .
12. Write a query to display the whole table
13. In the table kids . write a query to display name, sex and
aggregate/5
14. Write a query to display name and aggregate marks of those
kids who do not have their aggregate marks in the range of 380-
425.
15. Create a query that display by the format.
16. Write a query to display name, age, and marks(aggregate) of
students whose age is greater than or equal to 16 from table kids.
17. Write a query to display all the details from pet table for
species cat/dog having gender(sex) as male(‘m’).
18. Write a query to display the names of pets beginning with
‘F’. use table pet.
19. Write query to display the names of pets having the exactly
four letter names . use table pet.
20. Write a query to display name,age,aggregate of students
whose aggregate is between 300 and 400.

PYTHON:-
1. Write a program to input a wecome message and print it .
2. Program to obtain three numbers and their sum .
3. Program to obtain length and breadth of a rectangle and calculate
its area .
4. Program to calculate BMI (Body Mass Index) of a person.
5. Write aprogram to input a number and print its cube.
6. Write a program to input a value in kilometres and convert it into
miles .
7. Write a program to input value in tonnes and convert it into
quintals and kilograms .
8. Write a program to enter a small poem verse and print it.
9. Write a program to input two numbers and swap them.
10. Write a program to input three numbers and swap them as
this:1st number becomes the second one ,2nd becomes the 3rd
number and 3rd becomes the 1st number.
11. Write a program and print its output.
12. Write a program by using the given information and predict
its output.
13. Predict the output of following code.
14. What will be the output of following code.
15. Predict the output of given command
➢ Write SQL commands to check if a database by the name
newdb exits on MYSQL . If not then create a new database by
its name .

➢ Write SQL command to create STUDENT table with the


studentid, section,class,gender,name,dob,and marks as
attributes where the studentid is the primary key .
➢ Create table employee with the following structure :
Name of ID First_name Last_name User_id salary
column
type integer Varchar(30) Varchar(30) Varchar(10) Float

Ensure the following with folloing structure :


• Id should be declared as primary key
• User_ID should be unique
• Salary must be greater than 5000
• First_name and last_name must not remain blank

➢ Create another table job with following structure :


Name of Job_id Job_des Alloc_on Due_on Emp_id
column
type integer Varchar(30) DATE DATE INTEGER
➢ JOB_ID IS THE PRIMARY KEY
➢ JOB_DES,ALLOC_ON,DUE_ON CANNOT BE LEFT BLANK
➢ EMP_ID IS FOREIGN KEY HERE THAT IS RELATED TO ID COLUMN OF EARLIER
CREATED TABLE EMPLOYEE
➢ Write SQL command to create new table old which has exactly the
same structure as the student table created in a earlier questions.
Show the table structure of newly created table.

➢ Write SQL command to create a new table OLDSTU with only


studentid , gender, name and dob from the student table created
in an earlier question. Show the table structure of newly created
table.
➢ Add the following data in the above table (employee) as
instructed :-
ID First_name Last_name User_id salray
1 Dim Joseph Jdim 5000
2 Jagganath Mishra Jnmishra 4000
3 Siddharth Mishra Smrisha 8000
4 Shankar Giri Sgiri 7000
5 gautam buddha Bgautam 2000
• Populate table with first record mentioning the column list in the
insert clause.
• Populate table with next two records without mentioning the column
list in the insert clause .
• Populate table with 4th record and enter only id and first_name
• Populate table with 5th recorded and anter id , user id, and last_name
only.
Solutions :
(1) INSERT INTO Employee (ID, First_name, Last_name,
User_ID, Salary)
Values (1, 'Dim', 'Joseph', 'Jdim', 5000) ;
(ii) INSERT INTO Employee
Values (2, 'Jagannath', 'Mishra', 'jnmishra', 4000);
INSERT INTO Employee
Values (3, 'Siddarth', 'Mishra', 'smishra', 8000);
(iii) INSERT INTO Employee (ID, First_name)
Values (4, 'Shankar');
(iv) INSERT INTO Employee (ID, User_ID, Last_Name)
Values (5, 'bgautam', 'Buddha');

➢ Insert into empt table, the employee numbers, names ,


and salaries of all those employees of temp table that
havre completed 2 years. the structure of temp is as
follows:
Enum ename sal Months
Not null no.(4) Varchar(30) Number(7,2) Number(3)
➢ Display distinct species of pets from the table pet.

➢ Display species of all pets from table pet .


➢ Write a query to diplay name and sex .

➢ Write a query to display the whole table


➢ In the table kids . write a query to display name,
sex and aggregate/5. Label this computation as
percentage.

➢ Write a query to display name and aggregate


marks of those kids who do not have their
aggregate marks in the range of 380-425.
➢ Create a query that display in the following
format:
<studentname>obtained<aggregate>marks and has <aggregate/5>%
Consider the table kids for this.

➢ Write a query to display name, age, and


marks(aggregate) of students whose age is greater
than or equal to 16 from table kids.
➢ Write a query to display all the details from pet table
for species cat/dog having gender(sex) as male(‘m’).

➢ Write a query to display the names of pets beginning


with ‘F’. use table pet.
➢ Write query to display the names of pets having the
exactly four letter names . use table pet.

o Write a query to display name,age,aggregate of


students whose aggregate is between 300 and
400. Order the query in descending order of
name.


Python programs
➢ Write a program to input a wecome message and
print it .

Run:

• Program to obtain three numbers and their sum .

Run:
• Program to obtain length and breadth of a rectangle
and calculate its area .

Run:

• Program to calculate BMI (Body Mass Index) of a person.


Body Mass Index is a simple calculation using a person's
height and weight.The formula is BMI = kg/m2 where kg is
a person's weight in kilograms and m2 is their height in
metres squared.

Run:
• Write a program to input a number and print its
cube.

Run:

• Write a program to input a value in kilometres and


convert it into miles .

Run:
• Write a program to input value in tonnes and
convert it into quintals and kilograms .

Run:

• Write a program to enter a small poem verse and


print it.

Run:
• Write a program to input two numbers and swap
them.

Run:

• Write a program to input three numbers and swap them as


this:1st number becomes the second one ,2nd becomes the
3rd number and 3rd becomes the 1st number.

Run:
• Write a program and print its output.

Run:

• Write a program by using the given information and


predict its output.

Run:
• Predict the output of following code:

Run:
• What will be the output of following code:

Run:
• Predict the output:

Run:
Bibliography

• www.youtube.com
• www.ggeksforgeeks.com
• www.pythom.org
• www.wikipedia.com
• www.w3schools.com
• www.codecadamy.com
• www.mysql.com

---------------------------END-------------------------

You might also like